From ea6843267b75a19c28a1649ee7f385ca6ec4967d Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Fri, 1 Jun 2018 09:31:44 -0600 Subject: [PATCH] use clang-tidy to convert the usage of null pointer constants to use the new C++11 nullptr keyword. -header-filter=.*\\.h -checks=-*,modernize-use-nullptr -fix --- alan.cc | 68 ++++---- an1.cc | 80 ++++----- arcdist.cc | 48 +++--- bcr.cc | 74 ++++---- bend.cc | 30 ++-- brauniger_iq.cc | 14 +- bushnell.cc | 6 +- bushnell_trl.cc | 4 +- cet.cc | 42 ++--- cet/ansi_x3_4_1968.h | 8 +- cet/cp1252.h | 8 +- cet/iso_8859_8.h | 10 +- cet_util.cc | 82 ++++----- compegps.cc | 84 +++++----- cst.cc | 32 ++-- csv_util.cc | 68 ++++---- delgpl.cc | 6 +- destinator.cc | 30 ++-- dg-100.cc | 34 ++-- discard.cc | 58 +++---- dmtlog.cc | 42 ++--- duplicate.cc | 38 ++--- easygps.cc | 2 +- energympro.cc | 12 +- enigma.cc | 10 +- exif.cc | 84 +++++----- explorist_ini.cc | 12 +- f90g_track.cc | 16 +- filter_vecs.cc | 20 +-- formspec.cc | 8 +- g7towin.cc | 26 +-- garmin.cc | 74 ++++---- garmin_device_xml.cc | 12 +- garmin_fit.cc | 14 +- garmin_fs.cc | 78 ++++----- garmin_gpi.cc | 48 +++--- garmin_tables.cc | 48 +++--- garmin_txt.cc | 120 ++++++------- garmin_xt.cc | 12 +- gbfile.cc | 22 +-- gbser.cc | 4 +- gbser_posix.cc | 10 +- gbsleep.cc | 2 +- gdb.cc | 78 ++++----- geo.cc | 12 +- geojson.cc | 18 +- ggv_bin.cc | 22 +-- ggv_log.cc | 12 +- ggv_ovl.cc | 16 +- globalsat_sport.cc | 56 +++---- glogbook.cc | 8 +- gnav_trl.cc | 8 +- googledir.cc | 16 +- gopal.cc | 20 +-- gpssim.cc | 18 +- gpsutil.cc | 4 +- gpx.cc | 100 +++++------ gtm.cc | 22 +-- gtrnctr.cc | 18 +- height.cc | 16 +- hiketech.cc | 12 +- holux.cc | 14 +- html.cc | 38 ++--- humminbird.cc | 28 ++-- igc.cc | 50 +++--- ignrando.cc | 34 ++-- igo8.cc | 16 +- ik3d.cc | 22 +-- inifile.cc | 34 ++-- internal_styles.cc | 2 +- interpolate.cc | 20 +-- itracku.cc | 30 ++-- jeeps/gpsapp.cc | 16 +- jeeps/gpscom.cc | 22 +-- jeeps/gpsdatum.h | 4 +- jeeps/gpsdevice.cc | 2 +- jeeps/gpslibusb.cc | 10 +- jeeps/gpsmem.cc | 16 +- jeeps/gpsserial.cc | 6 +- jeeps/gpsusbcommon.cc | 2 +- jogmap.cc | 14 +- jtr.cc | 12 +- kml.cc | 82 ++++----- lmx.cc | 12 +- lowranceusr.cc | 20 +-- lowranceusr4.cc | 18 +- maggeo.cc | 12 +- magproto.cc | 88 +++++----- main.cc | 56 +++---- mapasia.cc | 20 +-- mapbar_track.cc | 10 +- mapfactor.cc | 8 +- mapsend.cc | 4 +- mapsource.cc | 70 ++++---- mkshort.cc | 22 +-- mmo.cc | 36 ++-- mtk_locus.cc | 62 +++---- mtk_logger.cc | 122 +++++++------- mynav.cc | 10 +- navicache.cc | 6 +- naviguide.cc | 14 +- navilink.cc | 98 +++++------ navitel.cc | 12 +- netstumbler.cc | 24 +-- nmea.cc | 66 ++++---- nmn4.cc | 10 +- nukedata.cc | 6 +- osm.cc | 32 ++-- ozi.cc | 52 +++--- parse.cc | 8 +- pcx.cc | 26 +-- pocketfms_bc.cc | 4 +- pocketfms_fp.cc | 32 ++-- pocketfms_wp.cc | 10 +- polygon.cc | 16 +- position.cc | 18 +- psitrex.cc | 14 +- queue.cc | 14 +- radius.cc | 36 ++-- random.cc | 24 +-- raymarine.cc | 26 +-- reverse_route.cc | 6 +- route.cc | 16 +- saroute.cc | 34 ++-- sbn.cc | 10 +- sbp.cc | 10 +- shape.cc | 26 +-- skyforce.cc | 32 ++-- skytraq.cc | 100 +++++------ smplrout.cc | 30 ++-- sort.cc | 12 +- src/core/xmltag.h | 8 +- stackfilter.cc | 54 +++--- stmsdf.cc | 58 +++---- stmwpp.cc | 32 ++-- subrip.cc | 22 +-- swapdata.cc | 10 +- tef_xml.cc | 28 ++-- teletype.cc | 6 +- text.cc | 42 ++--- tiger.cc | 46 ++--- tmpro.cc | 10 +- tomtom.cc | 8 +- tpg.cc | 2 +- tpo.cc | 12 +- trackfilter.cc | 168 +++++++++---------- transform.cc | 22 +-- unicsv.cc | 66 ++++---- util.cc | 54 +++--- v900.cc | 16 +- validate.cc | 6 +- vcf.cc | 12 +- vecs.cc | 380 +++++++++++++++++++++--------------------- vidaone.cc | 6 +- vitosmt.cc | 26 +-- vitovtt.cc | 16 +- vpl.cc | 8 +- waypt.cc | 22 +-- wbt-200.cc | 58 +++---- wfff_xml.cc | 34 ++-- wintec_tes.cc | 8 +- xcsv.cc | 60 +++---- xmlgeneric.cc | 16 +- xmltag.cc | 20 +-- xol.cc | 22 +-- yahoo.cc | 12 +- 166 files changed, 2597 insertions(+), 2597 deletions(-) diff --git a/alan.cc b/alan.cc index 32794de4f..8950e4ff2 100644 --- a/alan.cc +++ b/alan.cc @@ -174,7 +174,7 @@ enum { /**************************************************************************/ -static gbfile* fin = NULL, *fout = NULL; +static gbfile* fin = nullptr, *fout = nullptr; struct wprdata WPR; struct trldata TRL; @@ -234,10 +234,10 @@ static void swap_wpthdr(struct wpthdr* wpthdr, { int i; - if (swap32_func != NULL) { + if (swap32_func != nullptr) { swap32_func(&wpthdr->id); } - if (swap16_func != NULL) { + if (swap16_func != nullptr) { swap16_func(&wpthdr->num); swap16_func(&wpthdr->next); for (i=0; iusecount); } - if (swap32_func != NULL) { + if (swap32_func != nullptr) { swap32_func(&wpt->pt.x); swap32_func(&wpt->pt.y); swap32_func(&wpt->date); @@ -265,7 +265,7 @@ static void swap_rtehdr(struct rtehdr* rtehdr, { int i; - if (swap16_func != NULL) { + if (swap16_func != nullptr) { swap16_func(&rtehdr->num); swap16_func(&rtehdr->next); for (i=0; irteno); } - if (swap32_func != NULL) { + if (swap32_func != nullptr) { swap32_func(&rtehdr->id); } } @@ -283,14 +283,14 @@ static void swap_rte(struct rte* rte, { int i; - if (swap16_func != NULL) { + if (swap16_func != nullptr) { swap16_func(&rte->wptnum); for (i=0; iwptidx[i]); } swap16_func(&rte->reserved); } - if (swap32_func != NULL) { + if (swap32_func != nullptr) { swap32_func(&rte->date); swap32_func(&rte->time); } @@ -311,12 +311,12 @@ static void wpr_swap(struct wprdata* wprdata) swap32_func = rev_bytes; break; case SWAP_WORDS: /* swap words, PDP_ENDIAN */ - swap16_func = NULL; + swap16_func = nullptr; swap32_func = sw_words; break; case SWAP_BYTES: /* swap bytes */ swap16_func = sw_bytes; - swap32_func = NULL; + swap32_func = nullptr; break; default: return; /* never reached */ @@ -335,11 +335,11 @@ static void wpr_swap(struct wprdata* wprdata) static void swap_trkhdr(struct trkhdr* trkhdr, void (*swap16_func)(void*), void (*swap32_func)(void*)) { - if (swap16_func != NULL) { + if (swap16_func != nullptr) { swap16_func(&(trkhdr->totalpt)); swap16_func(&(trkhdr->next)); } - if (swap32_func != NULL) { + if (swap32_func != nullptr) { swap32_func(&(trkhdr->occupied)); swap32_func(&(trkhdr->show)); swap32_func(&(trkhdr->fill)); @@ -351,11 +351,11 @@ static void swap_loghdr(struct loghdr* loghdr, { int i; - if (swap16_func != NULL) { + if (swap16_func != nullptr) { swap16_func(&(loghdr->num)); swap16_func(&(loghdr->next)); } - if (swap32_func != NULL) { + if (swap32_func != nullptr) { swap32_func(&(loghdr->id)); swap32_func(&(loghdr->date)); swap32_func(&(loghdr->time)); @@ -370,13 +370,13 @@ static void swap_trklog(struct trklog* trklog, { int i; - if (swap16_func != NULL) { + if (swap16_func != nullptr) { for (i=0; ish[i].speed)); swap16_func(&(trklog->sh[i].height)); } } - if (swap32_func != NULL) { + if (swap32_func != nullptr) { for (i=0; ipt[i].x)); swap32_func(&(trklog->pt[i].y)); @@ -399,12 +399,12 @@ static void trl_swap(struct trldata* trldata) swap32_func = rev_bytes; break; case SWAP_WORDS: /* swap words, PDP_ENDIAN */ - swap16_func = NULL; + swap16_func = nullptr; swap32_func = sw_words; break; case SWAP_BYTES: /* swap bytes */ swap16_func = sw_bytes; - swap32_func = NULL; + swap32_func = nullptr; break; default: return; /* never reached */ @@ -425,14 +425,14 @@ static void str2lab(char* dest, const char* src, int len, const char* fmt, int i,j; j = 0; - if (src != NULL) { + if (src != nullptr) { for (i=0; iidx[n]; if (idx == WPT_IDX_NONE || wpthdr->used[idx] == WPT_UNUSED) { - return NULL; + return nullptr; } wpt = &(wprdata->wpt[idx]); @@ -548,7 +548,7 @@ static void wpr_read() /* waypoints */ for (i=0; iwptnum; j++) { WP = get_wpt(&wprdata, rte->wptidx[j]); - if (WP != NULL) { + if (WP != nullptr) { route_add_wpt(RT, WP); } } @@ -662,7 +662,7 @@ static int find_wpt(struct wprdata* wprdata, const Waypoint* WP) struct wpt pattern, *wpt; int i, wpt_idx; - str2lab(pattern.name, WP->shortname, WPT_NAME_LEN, NULL, 0); + str2lab(pattern.name, WP->shortname, WPT_NAME_LEN, nullptr, 0); pattern.pt.x = deg2pt(WP->longitude); pattern.pt.y = deg2pt(-WP->latitude); @@ -712,7 +712,7 @@ static int add_wpt(struct wprdata* wprdata, const Waypoint* WP,int isroute) wpt = &(wprdata->wpt[wpt_idx]); str2lab(wpt->name, WP->shortname, WPT_NAME_LEN, "W%05d", wpt_idx); - str2lab(wpt->comment, WP->description, WPT_COMMENT_LEN, NULL, 0); + str2lab(wpt->comment, WP->description, WPT_COMMENT_LEN, nullptr, 0); wpt->pt.x = deg2pt(WP->longitude); wpt->pt.y = deg2pt(-WP->latitude); wpt->usecount = isroute ? 1 : 0; @@ -754,8 +754,8 @@ static void wpr_route_hdr(const route_head* RT) rte = &(WPR.rte[rte_idx]); str2lab(rte->name, RT->rte_name, RTE_NAME_LEN, "R%03d", rte_idx); - str2lab(rte->comment, RT->rte_desc, RTE_COMMENT_LEN, NULL, 0); - pack_time(time(NULL), &(rte->date), &(rte->time)); + str2lab(rte->comment, RT->rte_desc, RTE_COMMENT_LEN, nullptr, 0); + pack_time(time(nullptr), &(rte->date), &(rte->time)); rtehdr->idx[hdr_idx] = rte_idx; rtehdr->used[rte_idx] = RTE_USED; @@ -833,7 +833,7 @@ static void trl_track_hdr(const route_head* TL) fatal(MYNAME ": Can't store more than %u tracklogs", MAXTRK); } - if (TL->rte_name != NULL) { + if (TL->rte_name != nullptr) { strncpy(trkhdr[idx].name, CSTRc(TL->rte_name), TRK_NAME_LEN); } if (*(trkhdr[idx].name) == '\0') { @@ -841,7 +841,7 @@ static void trl_track_hdr(const route_head* TL) } trkhdr[idx].name[TRK_NAME_LEN-1] = '\0'; - if (TL->rte_desc != NULL) { + if (TL->rte_desc != nullptr) { strncpy(trkhdr[idx].comment, CSTRc(TL->rte_desc), TRK_COMMENT_LEN); l = strlen(CSTRc(TL->rte_desc)); if (l < TRK_COMMENT_LEN-1) { @@ -930,7 +930,7 @@ static void trl_write() fill = 0x10000 - 2 * sizeof(struct trklog); buf = xmalloc(fill); - if (buf == NULL) { + if (buf == nullptr) { fatal(MYNAME ": Not enough memory\n"); } memset(buf, 0xff, fill); @@ -945,7 +945,7 @@ static void trl_write() fill = 0x1000 - sizeof(struct loghdr); buf = xmalloc(fill); - if (buf == NULL) { + if (buf == nullptr) { fatal(MYNAME ": Not enough memory\n"); } memset(buf, 0xff, fill); @@ -967,7 +967,7 @@ static void alan_rd_init(const QString& fname) static void alan_rd_deinit() { gbfclose(fin); - fin = NULL; + fin = nullptr; } @@ -979,7 +979,7 @@ static void alan_wr_init(const QString& fname) static void alan_wr_deinit() { gbfclose(fout); - fout = NULL; + fout = nullptr; } diff --git a/an1.cc b/an1.cc index a5b5b68cd..ebbc89c3c 100644 --- a/an1.cc +++ b/an1.cc @@ -28,15 +28,15 @@ static gbfile* infile; static gbfile* outfile; -static char* output_type = NULL; -static char* road_changes = NULL; -static char* nogc = NULL; -static char* nourl = NULL; -static char* opt_symbol = NULL; -static char* opt_color = NULL; -static char* opt_zoom = NULL; -static char* opt_wpt_type = NULL; -static char* opt_radius = NULL; +static char* output_type = nullptr; +static char* road_changes = nullptr; +static char* nogc = nullptr; +static char* nourl = nullptr; +static char* opt_symbol = nullptr; +static char* opt_color = nullptr; +static char* opt_zoom = nullptr; +static char* opt_wpt_type = nullptr; +static char* opt_radius = nullptr; static short output_type_num = 0; static short opt_zoom_num = 0; @@ -53,7 +53,7 @@ typedef struct roadchange { char* name; } roadchange; -roadchange* roadchanges = NULL; +roadchange* roadchanges = nullptr; static arglist_t an1_args[] = { @@ -67,11 +67,11 @@ arglist_t an1_args[] = { }, { "nogc", &nogc, "Do not add geocache data to description", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, { "nourl", &nourl, "Do not add URLs to description", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, { "deficon", &opt_symbol, "Symbol to use for point data", @@ -83,7 +83,7 @@ arglist_t an1_args[] = { }, { "zoom", &opt_zoom, "Zoom level to reduce points", - NULL, ARGTYPE_INT, ARG_NOMINMAX + nullptr, ARGTYPE_INT, ARG_NOMINMAX }, { "wpt_type", &opt_wpt_type, @@ -92,7 +92,7 @@ arglist_t an1_args[] = { }, { "radius", &opt_radius, "Radius for circles", - NULL, ARGTYPE_STRING, ARG_NOMINMAX + nullptr, ARGTYPE_STRING, ARG_NOMINMAX }, ARG_TERMINATOR }; @@ -115,7 +115,7 @@ typedef struct guid { static char* ReadString(gbfile* f, short len) { - char* result = NULL; + char* result = nullptr; result = (char*)xcalloc(1, len + 1); if (len) { gbfread(result, 1, len, f); @@ -284,12 +284,12 @@ void Copy_AN1_Waypoint(void** vdwpt, void* vwpt) static an1_waypoint_record* Alloc_AN1_Waypoint() { - an1_waypoint_record* result = NULL; + an1_waypoint_record* result = nullptr; result = (an1_waypoint_record*)xcalloc(sizeof(*result), 1); result->fs.type = FS_AN1W; result->fs.copy = Copy_AN1_Waypoint; result->fs.destroy = Destroy_AN1_Waypoint; - result->fs.convert = NULL; + result->fs.convert = nullptr; return result; } @@ -310,12 +310,12 @@ void Copy_AN1_Vertex(void** vdvert, void* vvert) static an1_vertex_record* Alloc_AN1_Vertex() { - an1_vertex_record* result = NULL; + an1_vertex_record* result = nullptr; result = (an1_vertex_record*)xcalloc(sizeof(*result), 1); result->fs.type = FS_AN1V; result->fs.copy = Copy_AN1_Vertex; result->fs.destroy = Destroy_AN1_Vertex; - result->fs.convert = NULL; + result->fs.convert = nullptr; return result; } @@ -340,12 +340,12 @@ void Copy_AN1_Line(void** vdline, void* vline) static an1_line_record* Alloc_AN1_Line() { - an1_line_record* result = NULL; + an1_line_record* result = nullptr; result = (an1_line_record*)xcalloc(sizeof(*result), 1); result->fs.type = FS_AN1L; result->fs.copy = Copy_AN1_Line; result->fs.destroy = Destroy_AN1_Line; - result->fs.convert = NULL; + result->fs.convert = nullptr; return result; } @@ -430,7 +430,7 @@ static void Read_AN1_Waypoint(gbfile* f, an1_waypoint_record* wpt) } else { len = ReadShort(f); wpt->fontname = ReadString(f, len); - wpt->image_name = NULL; + wpt->image_name = nullptr; } ReadGuid(f, &wpt->guid); wpt->fontcolor = ReadLong(f); @@ -688,9 +688,9 @@ static void Read_AN1_Waypoints(gbfile* f) { unsigned long count = 0; unsigned long i = 0; - an1_waypoint_record* rec = NULL; + an1_waypoint_record* rec = nullptr; Waypoint* wpt_tmp; - char* icon = NULL; + char* icon = nullptr; ReadShort(f); count = ReadLong(f); for (i = 0; i < count; i++) { @@ -727,7 +727,7 @@ static void Read_AN1_Waypoints(gbfile* f) } fs_chain_add(&(wpt_tmp->fs), (format_specific_data*)rec); - rec = NULL; + rec = nullptr; waypt_add(wpt_tmp); } } @@ -737,7 +737,7 @@ Write_One_AN1_Waypoint(const Waypoint* wpt) { an1_waypoint_record* rec; int local; - format_specific_data* fs = NULL; + format_specific_data* fs = nullptr; fs = fs_chain_find(wpt->fs, FS_AN1W); if (fs) { @@ -838,8 +838,8 @@ static void Read_AN1_Lines(gbfile* f) unsigned long count = 0; unsigned long i = 0; unsigned long j = 0; - an1_line_record* rec = NULL; - an1_vertex_record* vert = NULL; + an1_line_record* rec = nullptr; + an1_vertex_record* vert = nullptr; route_head* rte_head; Waypoint* wpt_tmp; @@ -906,7 +906,7 @@ Write_One_AN1_Line(const route_head* rte) { an1_line_record* rec; int local; - format_specific_data* fs = NULL; + format_specific_data* fs = nullptr; fs = fs_chain_find(rte->fs, FS_AN1L); @@ -946,7 +946,7 @@ Write_One_AN1_Line(const route_head* rte) } else { rec = Alloc_AN1_Line(); local = 1; - rec->name = NULL; + rec->name = nullptr; switch (output_type_num) { /* drawing road trail waypoint track */ case 1: /* road */ @@ -1003,7 +1003,7 @@ Write_One_AN1_Vertex(const Waypoint* wpt) { an1_vertex_record* rec; int local; - format_specific_data* fs = NULL; + format_specific_data* fs = nullptr; fs = fs_chain_find(wpt->fs, FS_AN1V); @@ -1029,8 +1029,8 @@ static void Write_AN1_Lines(gbfile* f) WriteShort(f, 2); WriteLong(f, route_count()+track_count()); - route_disp_all(Write_One_AN1_Line, NULL, Write_One_AN1_Vertex); - track_disp_all(Write_One_AN1_Line, NULL, Write_One_AN1_Vertex); + route_disp_all(Write_One_AN1_Line, nullptr, Write_One_AN1_Vertex); + track_disp_all(Write_One_AN1_Line, nullptr, Write_One_AN1_Vertex); } static void @@ -1135,17 +1135,17 @@ Free_Road_Changes() } xfree(roadchanges); } - roadchanges = NULL; + roadchanges = nullptr; } static void Init_Road_Changes() { int count = 0; - char* strType = NULL; - char* name = NULL; - char* bar = NULL; - char* copy = NULL; + char* strType = nullptr; + char* name = nullptr; + char* bar = nullptr; + char* copy = nullptr; Free_Road_Changes(); if (!road_changes || !road_changes[0]) { @@ -1163,7 +1163,7 @@ Init_Road_Changes() roadchanges = (roadchange*)xmalloc((count+1) * sizeof(roadchange)); roadchanges[count].type = 0; - roadchanges[count].name = NULL; + roadchanges[count].name = nullptr; copy = xstrdup(road_changes); bar = copy; @@ -1257,7 +1257,7 @@ ff_vecs_t an1_vecs = { wr_deinit, my_read, my_write, - NULL, + nullptr, an1_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/arcdist.cc b/arcdist.cc index 1e4ef8741..40a86378e 100644 --- a/arcdist.cc +++ b/arcdist.cc @@ -32,13 +32,13 @@ #define MYNAME "Arc filter" static double pos_dist; -static char* distopt = NULL; -static char* arcfileopt = NULL; -static char* rteopt = NULL; -static char* trkopt = NULL; -static char* exclopt = NULL; -static char* ptsopt = NULL; -static char* projectopt = NULL; +static char* distopt = nullptr; +static char* arcfileopt = nullptr; +static char* rteopt = nullptr; +static char* trkopt = nullptr; +static char* exclopt = nullptr; +static char* ptsopt = nullptr; +static char* projectopt = nullptr; typedef struct { double distance; @@ -51,31 +51,31 @@ static arglist_t arcdist_args[] = { { "file", &arcfileopt, "File containing vertices of arc", - NULL, ARGTYPE_FILE, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FILE, ARG_NOMINMAX, nullptr }, { "rte", &rteopt, "Route(s) are vertices of arc", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "trk", &trkopt, "Track(s) are vertices of arc", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "distance", &distopt, "Maximum distance from arc", - NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, { - "exclude", &exclopt, "Exclude points close to the arc", NULL, + "exclude", &exclopt, "Exclude points close to the arc", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "points", &ptsopt, "Use distance from vertices not lines", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "project", &projectopt, "Move waypoints to its projection on lines or vertices", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -90,7 +90,7 @@ arcdist_arc_disp_wpt_cb(const Waypoint* arcpt2) extra_data* ed; double dist; double prjlat, prjlon, frac; - static Waypoint* arcpt1 = NULL; + static Waypoint* arcpt1 = nullptr; if (arcpt2 && arcpt2->latitude != BADVAL && arcpt2->longitude != BADVAL && (ptsopt || (arcpt1 && @@ -150,7 +150,7 @@ static void arcdist_arc_disp_hdr_cb(const route_head*) { /* Set arcpt1 to NULL */ - arcdist_arc_disp_wpt_cb(NULL); + arcdist_arc_disp_wpt_cb(nullptr); } void @@ -169,11 +169,11 @@ arcdist_process() arcpt1 = new Waypoint; arcpt2 = new Waypoint; - arcdist_arc_disp_hdr_cb(NULL); + arcdist_arc_disp_hdr_cb(nullptr); arcpt2->latitude = arcpt2->longitude = BADVAL; while ((line = gbfgetstr(file_in))) { - char* pound = NULL; + char* pound = nullptr; int argsfound = 0; fileline++; @@ -181,7 +181,7 @@ arcdist_process() pound = strchr(line, '#'); if (pound) { if (0 == strncmp(pound, "#break", 6)) { - arcdist_arc_disp_hdr_cb(NULL); + arcdist_arc_disp_hdr_cb(nullptr); } *pound = '\0'; } @@ -203,9 +203,9 @@ arcdist_process() gbfclose(file_in); } else if (rteopt) { - route_disp_all(arcdist_arc_disp_hdr_cb, NULL, arcdist_arc_disp_wpt_cb); + route_disp_all(arcdist_arc_disp_hdr_cb, nullptr, arcdist_arc_disp_wpt_cb); } else if (trkopt) { - track_disp_all(arcdist_arc_disp_hdr_cb, NULL, arcdist_arc_disp_wpt_cb); + track_disp_all(arcdist_arc_disp_hdr_cb, nullptr, arcdist_arc_disp_wpt_cb); } removed = 0; @@ -217,9 +217,9 @@ arcdist_process() #endif extra_data* ed; ed = (extra_data*) wp->extra_data; - wp->extra_data = NULL; + wp->extra_data = nullptr; if (ed) { - if ((ed->distance >= pos_dist) == (exclopt == NULL)) { + if ((ed->distance >= pos_dist) == (exclopt == nullptr)) { waypt_del(wp); delete wp; removed++; @@ -300,7 +300,7 @@ filter_vecs_t arcdist_vecs = { arcdist_init, arcdist_process, arcdist_deinit, - NULL, + nullptr, arcdist_args }; #endif // FILTERS_ENABLED diff --git a/bcr.cc b/bcr.cc index 274b60f44..b9321759b 100644 --- a/bcr.cc +++ b/bcr.cc @@ -65,11 +65,11 @@ static arglist_t bcr_args[] = { { "index", &rtenum_opt, "Index of route to write (if more than one in source)", - NULL, ARGTYPE_INT, "1", NULL, nullptr + nullptr, ARGTYPE_INT, "1", nullptr, nullptr }, { "name", &rtename_opt, "New name for the route", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "radius", &radius_opt, "Radius of our big earth (default 6371000 meters)", "6371000", @@ -77,7 +77,7 @@ arglist_t bcr_args[] = { }, { "prefer_shortnames", &prefer_shortnames_opt, "Use shortname instead of description", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -94,7 +94,7 @@ bcr_icon_mapping_t bcr_icon_mapping[] = { { BCR_DEF_ICON, BCR_DEF_MPS_ICON, BCR_DEF_ICON, false }, { "", BCR_DEF_MPS_ICON, "Eigene Adressen", false }, { "AdrMon alpen", "Summit", "Pass-Strassen", false }, - { "AdrMon bauern", NULL, "Bauern- und Biohoefe", false }, + { "AdrMon bauern", nullptr, "Bauern- und Biohoefe", false }, { "AdrMon cmpngs", "Campground", "Campingplaetzte", false }, { "AdrMon p_aeu", "Scenic Area", "Sehenswertes", false }, { "AdrMon p_beu", "Gas Station", "Tanken", false }, @@ -102,25 +102,25 @@ bcr_icon_mapping_t bcr_icon_mapping[] = { { "AdrMon p_feu", "Restaurant", "Gastro", false }, { "AdrMon p_geu", "Museum", "Freizeit", false }, { "AdrMon p_heu", "Gas Station", "Tankstellen", false }, - { "AdrMon p_keu", NULL, "Faehrverbindungen", false }, - { "AdrMon p_leu", NULL, "Grenzuebergaenge", false }, - { "AdrMon p_teu", NULL, "Wein- und Sektgueter", false }, + { "AdrMon p_keu", nullptr, "Faehrverbindungen", false }, + { "AdrMon p_leu", nullptr, "Grenzuebergaenge", false }, + { "AdrMon p_teu", nullptr, "Wein- und Sektgueter", false }, { "AdrMon RUINEN", "Ghost Town", "Burgen und Schloesser", false }, { "AdrMon NFHAUS", "Residence", "Naturfreundehaeuser", false }, { "AdrMon racing", "Bike Trail", "Rennstrecken", false }, { "AdrMon TNKRST", "Bar", "Tankraststaetten", false }, { "AdrMon tpclub", "Contact, Biker", "Motorrad-Clubs", false }, - { "AdrMon tpequ", NULL, "Motorrad-Equipment", false }, + { "AdrMon tpequ", nullptr, "Motorrad-Equipment", false }, { "AdrMon tphot", "Hotel", "Motorrad-Hotels", false }, - { "AdrMon tpmh", NULL, "Motorradhaendler", false }, + { "AdrMon tpmh", nullptr, "Motorradhaendler", false }, { "AdrMon tpss", "Restricted Area", "Sperrungen", false }, { "AdrMon tpsw", "Scenic Area", "Sehenswertes", false }, - { "AdrMon tptref", NULL, "Treffpunkte", false }, + { "AdrMon tptref", nullptr, "Treffpunkte", false }, { "AdrMon VORTE", "Information", "Ortsinformationen", false }, - { "AdrMon WEBCAM", NULL, "WebCam-Standorte", false }, - { "AdrMon youthh", NULL, "Jugendherbergen", false }, + { "AdrMon WEBCAM", nullptr, "WebCam-Standorte", false }, + { "AdrMon youthh", nullptr, "Jugendherbergen", false }, { "Town", "City (Small)", "Orte", false }, - { NULL, NULL, NULL, false } + { nullptr, nullptr, nullptr, false } }; static void @@ -134,7 +134,7 @@ bcr_handle_icon_str(const char* str, Waypoint* wpt) if (case_ignore_strcmp(str, m->bcr_name) == 0) { int nr; - if (m->symbol_DE == NULL) { + if (m->symbol_DE == nullptr) { if (! m->warned) { m->warned = true; warning(MYNAME ": Unknown icon \"%s\" found. Please report.\n", str); @@ -142,7 +142,7 @@ bcr_handle_icon_str(const char* str, Waypoint* wpt) return; } wpt->description = m->symbol_DE; - if (m->mps_name != NULL) { + if (m->mps_name != nullptr) { nr = gt_find_icon_number_from_desc(m->mps_name, MAPSOURCE); wpt->icon_descr = gt_find_desc_from_icon_number(nr, MAPSOURCE); } @@ -175,7 +175,7 @@ get_bcr_icon_from_icon_descr(const QString& icon_descr) static void bcr_init_radius() { - if (radius_opt != NULL) { /* preinitialize the earth radius */ + if (radius_opt != nullptr) { /* preinitialize the earth radius */ radius = atof(radius_opt); if (radius <= 0) { fatal(MYNAME ": Sorry, the radius should be greater than zero!\n"); @@ -274,7 +274,7 @@ bcr_data_read() Waypoint* wpt; snprintf(station, sizeof(station), "STATION%d", index); - if (NULL == (str = inifile_readstr(ini, "coordinates", station))) { + if (nullptr == (str = inifile_readstr(ini, "coordinates", station))) { break; } @@ -287,22 +287,22 @@ bcr_data_read() wpt->shortname = station; bcr_mercator_to_wgs84(mlat, mlon, &wpt->latitude, &wpt->longitude); - if (NULL != (str = inifile_readstr(ini, "client", station))) { + if (nullptr != (str = inifile_readstr(ini, "client", station))) { char* cx; cx = strchr(str, ','); - if (cx == NULL) { + if (cx == nullptr) { fatal(MYNAME ": structure error at %s (Client)!\n", station); } *cx++ = '\0'; bcr_handle_icon_str(str, wpt); } - if (NULL != (str = inifile_readstr(ini, "description", station))) { + if (nullptr != (str = inifile_readstr(ini, "description", station))) { char* c; c = strchr(str, ','); - if (c != NULL) { + if (c != nullptr) { *c = '\0'; } if (*str) { @@ -311,7 +311,7 @@ bcr_data_read() if ((str = c)) { str++; c = strchr(str, ','); - if (c != NULL) { + if (c != nullptr) { *c = '\0'; } if (*str) { @@ -364,8 +364,8 @@ void bcr_write_line(gbfile* fout, const QString& key, int* index, const QString& } else { char* tmp; - tmp = (value != NULL) ? xstrdup(value) : xstrdup(""); - if (index != NULL) { + tmp = (value != nullptr) ? xstrdup(value) : xstrdup(""); + if (index != nullptr) { gbfprintf(fout, "%s%d=%s\r\n", CSTR(key), *index, tmp); } else { gbfprintf(fout, "%s=%s\r\n", CSTR(key), tmp); @@ -387,20 +387,20 @@ bcr_route_header(const route_head* route) return; } - bcr_write_line(fout, "[CLIENT]", NULL, NULL); /* client section */ - bcr_write_line(fout, "REQUEST", NULL, "TRUE"); + bcr_write_line(fout, "[CLIENT]", nullptr, nullptr); /* client section */ + bcr_write_line(fout, "REQUEST", nullptr, "TRUE"); sout = route->rte_name; - if (rtename_opt != 0) { + if (rtename_opt != nullptr) { sout = rtename_opt; } - if (sout != NULL) { - bcr_write_line(fout, "ROUTENAME", NULL, sout); + if (sout != nullptr) { + bcr_write_line(fout, "ROUTENAME", nullptr, sout); } else { - bcr_write_line(fout, "ROUTENAME", NULL, "Route"); + bcr_write_line(fout, "ROUTENAME", nullptr, "Route"); } - bcr_write_line(fout, "DESCRIPTIONLINES", NULL, "0"); + bcr_write_line(fout, "DESCRIPTIONLINES", nullptr, "0"); i = 0; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { @@ -415,7 +415,7 @@ bcr_route_header(const route_head* route) bcr_write_line(fout, "STATION", &i, sout); } - bcr_write_line(fout, "[COORDINATES]", NULL, NULL); /* coords section */ + bcr_write_line(fout, "[COORDINATES]", nullptr, nullptr); /* coords section */ nmin = emin = (1<<30); emax = nmax = -nmin; @@ -444,7 +444,7 @@ bcr_route_header(const route_head* route) bcr_write_line(fout, "STATION", &i, sout); } - bcr_write_line(fout, "[DESCRIPTION]", NULL, NULL); /* descr. section */ + bcr_write_line(fout, "[DESCRIPTION]", nullptr, nullptr); /* descr. section */ i = 0; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { @@ -484,13 +484,13 @@ bcr_route_header(const route_head* route) bcr_write_line(fout, "STATION", &i, sout); } - bcr_write_line(fout, "[ROUTE]", NULL, NULL); /* route section */ + bcr_write_line(fout, "[ROUTE]", nullptr, nullptr); /* route section */ sout = QString::number(emin) + "," + QString::number(nmax) + "," + QString::number(emax) + "," + QString::number(nmin); - bcr_write_line(fout, "ROUTERECT", NULL, sout); + bcr_write_line(fout, "ROUTERECT", nullptr, sout); } static void @@ -498,7 +498,7 @@ bcr_data_write() { target_rte_num = 1; - if (rtenum_opt != NULL) { + if (rtenum_opt != nullptr) { target_rte_num = atoi(rtenum_opt); if (((unsigned)target_rte_num > route_count()) || (target_rte_num < 1)) fatal(MYNAME ": invalid route number %d (1..%d))!\n", @@ -517,7 +517,7 @@ ff_vecs_t bcr_vecs = { bcr_wr_deinit, bcr_data_read, bcr_data_write, - NULL, + nullptr, bcr_args, CET_CHARSET_MS_ANSI, 0, /* CET-REVIEW */ NULL_POS_OPS, diff --git a/bend.cc b/bend.cc index 4c750e23f..9800b123f 100644 --- a/bend.cc +++ b/bend.cc @@ -31,13 +31,13 @@ #if FILTERS_ENABLED -static char* distopt = NULL; -static char* minangleopt = NULL; +static char* distopt = nullptr; +static char* minangleopt = nullptr; static double maxDist; static double minAngle; -static queue* routes_orig = NULL; +static queue* routes_orig = nullptr; static int routes_orig_num = 0; static @@ -58,12 +58,12 @@ bend_init(const char*) { maxDist = 0.0; if (distopt) { - maxDist = strtod(distopt, NULL); + maxDist = strtod(distopt, nullptr); } minAngle = 0.0; if (minangleopt) { - minAngle = strtod(minangleopt, NULL); + minAngle = strtod(minangleopt, nullptr); } route_backup(&routes_orig_num, &routes_orig); @@ -79,10 +79,10 @@ create_wpt_dest(const Waypoint* wpt_orig, double lat_orig, double frac; double lat_dest; double long_dest; - Waypoint* wpt_dest = NULL; + Waypoint* wpt_dest = nullptr; distance = radtometers(distance); if (distance <= maxDist) { - return NULL; + return nullptr; } frac = maxDist / distance; @@ -117,15 +117,15 @@ is_small_angle(double lat_orig, double long_orig, double lat_orig_prev, static void process_route(const route_head* route_orig, route_head* route_dest) { - Waypoint* wpt_orig_prev = NULL; - Waypoint* wpt_orig = NULL; + Waypoint* wpt_orig_prev = nullptr; + Waypoint* wpt_orig = nullptr; queue* elem, *tmp; QUEUE_FOR_EACH(&route_orig->waypoint_list, elem, tmp) { Waypoint* wpt_orig_next = (Waypoint*)elem; - if (wpt_orig_prev == NULL) { - if (wpt_orig != NULL) { + if (wpt_orig_prev == nullptr) { + if (wpt_orig != nullptr) { Waypoint* waypoint_dest = new Waypoint(*wpt_orig); route_add_wpt(route_dest, waypoint_dest); } @@ -138,7 +138,7 @@ process_route(const route_head* route_orig, route_head* route_dest) double lat_orig_next = RAD(wpt_orig_next->latitude); double long_orig_next = RAD(wpt_orig_next->longitude); - Waypoint* wpt_dest_next = NULL; + Waypoint* wpt_dest_next = nullptr; if (is_small_angle(lat_orig, long_orig, lat_orig_prev, long_orig_prev, lat_orig_next, long_orig_next)) { @@ -147,13 +147,13 @@ process_route(const route_head* route_orig, route_head* route_dest) } else { Waypoint* wpt_dest_prev = create_wpt_dest(wpt_orig, lat_orig, long_orig, lat_orig_prev, long_orig_prev); - if (wpt_dest_prev != NULL) { + if (wpt_dest_prev != nullptr) { route_add_wpt(route_dest, wpt_dest_prev); } wpt_dest_next = create_wpt_dest(wpt_orig, lat_orig, long_orig, lat_orig_next, long_orig_next); - if (wpt_dest_next != NULL) { + if (wpt_dest_next != nullptr) { route_add_wpt(route_dest, wpt_dest_next); wpt_orig = wpt_dest_next; @@ -165,7 +165,7 @@ process_route(const route_head* route_orig, route_head* route_dest) wpt_orig = wpt_orig_next; } - if (wpt_orig != NULL) { + if (wpt_orig != nullptr) { Waypoint* waypoint_dest = new Waypoint(*wpt_orig); route_add_wpt(route_dest, waypoint_dest); } diff --git a/brauniger_iq.cc b/brauniger_iq.cc index 92089f140..9996efa63 100644 --- a/brauniger_iq.cc +++ b/brauniger_iq.cc @@ -58,7 +58,7 @@ static const int reqd_bytes[num_states] = { 6, 1, 2, 2, 25, 2, 2, 2, 2, 2, 2, 1, static void rd_init(const QString& fname) { - if (serial_handle = gbser_init(qPrintable(fname)), NULL == serial_handle) { + if (serial_handle = gbser_init(qPrintable(fname)), nullptr == serial_handle) { fatal(MYNAME ": Can't open port '%s'\n", qPrintable(fname)); } if (gbser_set_port(serial_handle, 9600, 8, 0, 1) != gbser_OK) { @@ -69,7 +69,7 @@ static void rd_init(const QString& fname) static void rd_deinit() { gbser_deinit(serial_handle); - serial_handle = NULL; + serial_handle = nullptr; } /** @@ -84,7 +84,7 @@ static int process_data(const unsigned char* data) static route_head* track; static unsigned char interval; time_t finish; - Waypoint* wpt = NULL; + Waypoint* wpt = nullptr; int i; if (global_opts.debug_level >= 3) { @@ -268,12 +268,12 @@ ff_vecs_t brauniger_iq_vecs = { ff_type_serial, { ff_cap_none, ff_cap_read, ff_cap_none}, rd_init, - NULL, + nullptr, rd_deinit, - NULL, + nullptr, data_read, - NULL, - NULL, + nullptr, + nullptr, brauniger_iq_args, CET_CHARSET_UTF8, 1 /* master process: don't convert anything | CET-REVIEW */ , NULL_POS_OPS, diff --git a/bushnell.cc b/bushnell.cc index 1cc6fb53c..4945aced9 100644 --- a/bushnell.cc +++ b/bushnell.cc @@ -27,7 +27,7 @@ static gbfile* file_in; static QString ofname; -static short_handle mkshort_handle = NULL; +static short_handle mkshort_handle = nullptr; static arglist_t bushnell_args[] = { @@ -124,7 +124,7 @@ icon_mapping_t bushnell_icons[] = { { 0x42, "Officer" }, // "see 3b: duplicate" { 0x43, "Railroad" }, { 0x44, "Auto Ferry" }, - {-1, NULL} + {-1, nullptr} }; static unsigned int @@ -266,7 +266,7 @@ ff_vecs_t bushnell_vecs = { wr_deinit, bushnell_read, bushnell_write, - NULL, + nullptr, bushnell_args, CET_CHARSET_MS_ANSI, 0 /* Not really sure... */ }; diff --git a/bushnell_trl.cc b/bushnell_trl.cc index 59a38e760..e61b512de 100644 --- a/bushnell_trl.cc +++ b/bushnell_trl.cc @@ -133,7 +133,7 @@ bushnell_write_one(const Waypoint* wpt) static void bushnell_write() { - track_disp_all(NULL, NULL, bushnell_write_one); + track_disp_all(nullptr, nullptr, bushnell_write_one); } ff_vecs_t bushnell_trl_vecs = { @@ -145,7 +145,7 @@ ff_vecs_t bushnell_trl_vecs = { wr_deinit, bushnell_read, bushnell_write, - NULL, + nullptr, bushnell_args, CET_CHARSET_MS_ANSI, 0 /* Not really sure... */ }; diff --git a/cet.cc b/cet.cc index aeaf06a7b..bd14b8fad 100644 --- a/cet.cc +++ b/cet.cc @@ -41,7 +41,7 @@ cet_char_to_ucs4(const char src, const cet_cs_vec_t* vec, int* value) int* dest; c = ((unsigned char)src & 0xFF); - dest = (value != NULL) ? value : &trash; + dest = (value != nullptr) ? value : &trash; *dest = c; c -= vec->ucs4_offset; @@ -71,7 +71,7 @@ cet_ucs4_to_utf8(char* dest, size_t dest_size, int value) unsigned char trash[16]; unsigned char* c; - c = (dest != NULL) ? (unsigned char*) dest : trash; + c = (dest != nullptr) ? (unsigned char*) dest : trash; if ((value & 0xffffff80) == 0) { /* <= 7 bits */ if (dest_size < 1) { @@ -143,10 +143,10 @@ cet_utf8_to_ucs4(const char* str, int* bytes, int* value) unsigned char* cp = (unsigned char*)str; if (*cp < 0x80) { - if (bytes != NULL) { + if (bytes != nullptr) { *bytes = 1; } - if (value != NULL) { + if (value != nullptr) { *value = *cp; } return CET_SUCCESS; @@ -170,10 +170,10 @@ cet_utf8_to_ucs4(const char* str, int* bytes, int* value) res = (res << 6) | (*c++ & 0x3f); } - if (bytes != NULL) { + if (bytes != nullptr) { *bytes = len + 1; } - if (value != NULL) { + if (value != nullptr) { *value = res; } return CET_SUCCESS; @@ -184,10 +184,10 @@ cet_utf8_to_ucs4(const char* str, int* bytes, int* value) mask = (mask >> 1) | 0x80; } } - if (bytes != NULL) { + if (bytes != nullptr) { *bytes = 1; } - if (value != NULL) { + if (value != nullptr) { *value = *cp; } return CET_ERROR; /* not valid */ @@ -263,10 +263,10 @@ cet_utf8_to_char(const char* str, const cet_cs_vec_t* vec, /* out */ int* bytes, cet_utf8_to_ucs4(str, &b, &v); /* decode UTF-8 sequence */ - if (bytes != NULL) { + if (bytes != nullptr) { *bytes = b; } - if (value != NULL) { + if (value != nullptr) { *value = v; } @@ -311,7 +311,7 @@ cet_utf8_strdup(const char* str) if (str) { return cet_utf8_strndup(str, strlen(str)); } else { - return NULL; + return nullptr; } } @@ -347,7 +347,7 @@ cet_utf8_strndup(const char* str, const int maxlen) return res; } else { - return NULL; + return nullptr; } } @@ -366,8 +366,8 @@ cet_str_utf8_to_any(const char* src, const cet_cs_vec_t* vec) int len; char* res, *dest, *cend; - if (c == NULL) { - return NULL; + if (c == nullptr) { + return nullptr; } if (vec->ucs4_count == 0) { return xstrdup(src); /* UTF-8 -> UTF-8 */ @@ -380,7 +380,7 @@ cet_str_utf8_to_any(const char* src, const cet_cs_vec_t* vec) while (c < cend) { int bytes; - *dest++ = cet_utf8_to_char(c, vec, &bytes, NULL); + *dest++ = cet_utf8_to_char(c, vec, &bytes, nullptr); c += bytes; } *dest = '\0'; @@ -401,8 +401,8 @@ cet_str_any_to_utf8(const char* src, const cet_cs_vec_t* vec) char temp = CET_NOT_CONVERTABLE_DEFAULT; cin = (char*)src; - if (cin == NULL) { - return NULL; + if (cin == nullptr) { + return nullptr; } if (vec->ucs4_count == 0) { return xstrdup(src); /* UTF-8 -> UTF-8 */ @@ -413,7 +413,7 @@ cet_str_any_to_utf8(const char* src, const cet_cs_vec_t* vec) if (CET_ERROR == cet_char_to_ucs4(*cin++, vec, &value)) { cet_char_to_ucs4(temp, vec, &value); } - len += cet_ucs4_to_utf8(NULL, 6, value); + len += cet_ucs4_to_utf8(nullptr, 6, value); } result = cout = (char*) xmalloc(len + 1); @@ -440,8 +440,8 @@ cet_str_uni_to_utf8(const short* src, const int length) unsigned short* cin; char* res, *cout; - if (src == NULL) { - return NULL; + if (src == nullptr) { + return nullptr; } len = 0; @@ -449,7 +449,7 @@ cet_str_uni_to_utf8(const short* src, const int length) cin = (unsigned short*)src; while (i-- > 0) { - len += cet_ucs4_to_utf8(NULL, 6, le_read16(cin++)); + len += cet_ucs4_to_utf8(nullptr, 6, le_read16(cin++)); } res = cout = (char*) xmalloc(len + 1); diff --git a/cet/ansi_x3_4_1968.h b/cet/ansi_x3_4_1968.h index 0ad2b0b96..19a139cca 100644 --- a/cet/ansi_x3_4_1968.h +++ b/cet/ansi_x3_4_1968.h @@ -31,7 +31,7 @@ const char *cet_cs_alias_ansi_x3_4_1968[] = "ANSI_X3.4-1968", "367", "ANSI_X3.4-1986", "ASCII", "CP367", "csASCII", "IBM367", "ISO646-US", "ISO646.1991-IRV", "iso-ir-6", "ISO_646.irv:1991", "us", - NULL + nullptr }; #define cet_ucs4_ofs_ansi_x3_4_1968 128 @@ -447,8 +447,8 @@ cet_cs_vec_t cet_cs_vec_ansi_x3_4_1968 = /* defined in cet.h */ cet_cs_name_ansi_x3_4_1968, /* name of character set */ cet_cs_alias_ansi_x3_4_1968, /* alias table */ - NULL, /* fallback character set */ - NULL, /* unused */ + nullptr, /* fallback character set */ + nullptr, /* unused */ cet_ucs4_map_ansi_x3_4_1968, /* char to UCS-4 value table */ cet_ucs4_ofs_ansi_x3_4_1968, /* first non standard character */ @@ -460,7 +460,7 @@ cet_cs_vec_t cet_cs_vec_ansi_x3_4_1968 = /* defined in cet.h */ cet_ucs4_to_ansi_x3_4_1968_extra, /* hand made UCS-4 links */ sizeof(cet_ucs4_to_ansi_x3_4_1968_extra) / sizeof(cet_ucs4_to_ansi_x3_4_1968_extra[0]), /* number of extra links */ - NULL /* for internal use */ + nullptr /* for internal use */ }; diff --git a/cet/cp1252.h b/cet/cp1252.h index f270bdb05..514f02809 100644 --- a/cet/cp1252.h +++ b/cet/cp1252.h @@ -29,7 +29,7 @@ const char *cet_cs_alias_cp1252[] = { "CP1252", "1252", "ms-ansi", "windows-1252", "WIN-CP1252", - NULL + nullptr }; #define cet_ucs4_ofs_cp1252 128 @@ -152,8 +152,8 @@ cet_cs_vec_t cet_cs_vec_cp1252 = /* defined in cet.h */ cet_cs_name_cp1252, /* name of character set */ cet_cs_alias_cp1252, /* alias table */ - NULL, /* ... to UCS-4 converter (multi-byte) */ - NULL, /* UCS-4 to ... converter (multi-byte) */ + nullptr, /* ... to UCS-4 converter (multi-byte) */ + nullptr, /* UCS-4 to ... converter (multi-byte) */ cet_ucs4_map_cp1252, /* char to UCS-4 value table */ cet_ucs4_ofs_cp1252, /* first non standard character */ @@ -165,7 +165,7 @@ cet_cs_vec_t cet_cs_vec_cp1252 = /* defined in cet.h */ cet_ucs4_to_cp1252_extra, /* hand made UCS-4 links */ cet_ucs4_to_cp1252_extra_ct, /* number of extra links */ - NULL /* for internal use */ + nullptr /* for internal use */ }; diff --git a/cet/iso_8859_8.h b/cet/iso_8859_8.h index e22f04a60..69470e3f4 100644 --- a/cet/iso_8859_8.h +++ b/cet/iso_8859_8.h @@ -29,7 +29,7 @@ const char *cet_cs_alias_iso_8859_8[] = { "ISO-8859-8", "csISOLatinHebrew", "hebrew", "ISO8859-8", - "iso-ir-138", "ISO_8859-8", "ISO_8859-8:1988", NULL + "iso-ir-138", "ISO_8859-8", "ISO_8859-8:1988", nullptr }; #define cet_ucs4_ofs_iso_8859_8 161 @@ -98,8 +98,8 @@ cet_cs_vec_t cet_cs_vec_iso_8859_8 = /* defined in cet.h */ cet_cs_name_iso_8859_8, /* name of character set */ cet_cs_alias_iso_8859_8, /* alias table */ - NULL, /* ... to UCS-4 converter (multi-byte) */ - NULL, /* UCS-4 to ... converter (multi-byte) */ + nullptr, /* ... to UCS-4 converter (multi-byte) */ + nullptr, /* UCS-4 to ... converter (multi-byte) */ cet_ucs4_map_iso_8859_8, /* char to UCS-4 value table */ cet_ucs4_ofs_iso_8859_8, /* first non standard character */ @@ -108,10 +108,10 @@ cet_cs_vec_t cet_cs_vec_iso_8859_8 = /* defined in cet.h */ cet_ucs4_to_iso_8859_8_links, /* UCS-4 to char links */ cet_ucs4_to_iso_8859_8_ct, /* number of links */ - NULL, /* hand made UCS-4 links */ + nullptr, /* hand made UCS-4 links */ 0, /* number of extra links */ - NULL /* for internal use */ + nullptr /* for internal use */ }; diff --git a/cet_util.cc b/cet_util.cc index dd498f26c..122b3f17c 100644 --- a/cet_util.cc +++ b/cet_util.cc @@ -29,7 +29,7 @@ #define MYNAME "cet_util" -static cet_cs_vec_t* cet_cs_vec_root = NULL; +static cet_cs_vec_t* cet_cs_vec_root = nullptr; typedef struct cet_cs_alias_s { char* name; @@ -64,11 +64,11 @@ char* cet_str_any_to_any(const char* src, const cet_cs_vec_t* src_vec, const cet_cs_vec_t* dest_vec) { char* c0, *c1; - const cet_cs_vec_t* v_in = (src_vec != NULL) ? src_vec : &cet_cs_vec_ansi_x3_4_1968; - const cet_cs_vec_t* v_out = (dest_vec != NULL) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968; + const cet_cs_vec_t* v_in = (src_vec != nullptr) ? src_vec : &cet_cs_vec_ansi_x3_4_1968; + const cet_cs_vec_t* v_out = (dest_vec != nullptr) ? dest_vec : &cet_cs_vec_ansi_x3_4_1968; - if (src == NULL) { - return NULL; + if (src == nullptr) { + return nullptr; } else if ((*src == '\0') || (v_in == v_out)) { return xstrdup(src); } @@ -91,7 +91,7 @@ cet_cs_alias_qsort_cb(const void* a, const void* b) void cet_register_cs(cet_cs_vec_t* vec) { - if (vec->next == NULL) { + if (vec->next == nullptr) { vec->next = cet_cs_vec_root; cet_cs_vec_root = vec; cet_cs_vec_ct++; @@ -104,22 +104,22 @@ cet_register_cs(cet_cs_vec_t* vec) /* Dummy vector for our native character set */ const char* cet_cs_utf8_alias[] = { - "utf8", NULL + "utf8", nullptr }; cet_cs_vec_t cet_cs_vec_utf8 = { CET_CHARSET_UTF8, cet_cs_utf8_alias, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, 0, 0, - NULL, + nullptr, 0, - NULL, + nullptr, 0, - NULL, + nullptr, }; void @@ -127,7 +127,7 @@ cet_register() { int i, c; - if (cet_cs_vec_root != NULL) { + if (cet_cs_vec_root != nullptr) { return; } @@ -152,11 +152,11 @@ cet_register() /* enumerate count of all names and aliases */ - for (p = cet_cs_vec_root; p != NULL; p = p->next) { + for (p = cet_cs_vec_root; p != nullptr; p = p->next) { c++; - if (p->alias != NULL) { + if (p->alias != nullptr) { char** a = (char**)p->alias; - while ((*a) != NULL) { + while ((*a) != nullptr) { a++; c++; } @@ -166,14 +166,14 @@ cet_register() list = (cet_cs_alias_t*) xcalloc(c, sizeof(*list)); i = 0; - for (p = cet_cs_vec_root; p != NULL; p = p->next) { - if (p->alias != NULL) { + for (p = cet_cs_vec_root; p != nullptr; p = p->next) { + if (p->alias != nullptr) { char** a = (char**)p->alias; list[i].name = xstrdup(p->name); list[i].vec = p; i++; - while (*a != NULL) { + while (*a != nullptr) { list[i].name = xstrdup(*a); list[i].vec = p; i++; @@ -217,8 +217,8 @@ cet_find_cs_by_name(const QString& name) cet_register(); - if (cet_cs_alias == NULL) { - return NULL; + if (cet_cs_alias == nullptr) { + return nullptr; } i = 0; @@ -239,7 +239,7 @@ cet_find_cs_by_name(const QString& name) i = a + 1; } } - return NULL; + return nullptr; } void @@ -249,12 +249,12 @@ cet_deregister() int j = cet_cs_alias_ct; cet_cs_alias_t* p = cet_cs_alias; - if (p == NULL) { + if (p == nullptr) { return; } cet_cs_alias_ct = 0; - cet_cs_alias = NULL; + cet_cs_alias = nullptr; for (i = 0; i < j; i++) { xfree(p[i].name); @@ -276,7 +276,7 @@ cet_validate_cs(const QString& cs, cet_cs_vec_t** vec, QString* cs_name) } v = cet_find_cs_by_name(cs); - if (v != NULL) { + if (v != nullptr) { // TODO: make v->name into q QString and replace this... char* tmp = xstrdup(v->name); *cs_name = strupper(tmp); @@ -285,7 +285,7 @@ cet_validate_cs(const QString& cs, cet_cs_vec_t** vec, QString* cs_name) return 1; } else { cs_name->clear(); - *vec = NULL; + *vec = nullptr; return 0; } } @@ -293,14 +293,14 @@ cet_validate_cs(const QString& cs, cet_cs_vec_t** vec, QString* cs_name) void cet_convert_deinit() { - global_opts.charset = NULL; - global_opts.codec = NULL; + global_opts.charset = nullptr; + global_opts.codec = nullptr; } void cet_convert_init(const QString& cs_name, const int force) { - if ((force != 0) || (global_opts.charset == NULL)) { + if ((force != 0) || (global_opts.charset == nullptr)) { cet_convert_deinit(); if (0 == cet_validate_cs(cs_name, &global_opts.charset, &global_opts.charset_name)) { Fatal() << "Unsupported character set \"" << cs_name << "."; @@ -335,15 +335,15 @@ static void cet_flag_all() { waypt_disp_all(cet_flag_waypt); - route_disp_all(cet_flag_route, NULL, cet_flag_waypt); - track_disp_all(cet_flag_route, NULL, cet_flag_waypt); + route_disp_all(cet_flag_route, nullptr, cet_flag_waypt); + track_disp_all(cet_flag_route, nullptr, cet_flag_waypt); } /* -------------------------------------------------------------------- */ /* %%% complete data strings transformation %%% */ /* -------------------------------------------------------------------- */ -static char* (*converter)(const char*) = NULL; +static char* (*converter)(const char*) = nullptr; /* two converters */ @@ -366,8 +366,8 @@ cet_convert_string(char* str) { char* res; - if (str == NULL) { - return NULL; /* return origin if empty or NULL */ + if (str == nullptr) { + return nullptr; /* return origin if empty or NULL */ } else if (*str == '\0') { return str; } @@ -401,8 +401,8 @@ cet_convert_waypt(const Waypoint* wpt) w->wpt_flags.cet_converted = 1; fs = wpt->fs; - while (fs != NULL) { - if (fs->convert != NULL) { + while (fs != nullptr) { + if (fs->convert != nullptr) { fs->convert(fs); } fs = fs->next; @@ -443,10 +443,10 @@ cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* target, cons char* cs_name_from, *cs_name_to; (void)format; - converter = NULL; + converter = nullptr; - if ((source == NULL) || (source == &cet_cs_vec_utf8)) { - if ((target == NULL) || (target == &cet_cs_vec_utf8)) { + if ((source == nullptr) || (source == &cet_cs_vec_utf8)) { + if ((target == nullptr) || (target == &cet_cs_vec_utf8)) { cet_flag_all(); return; } @@ -457,7 +457,7 @@ cet_convert_strings(const cet_cs_vec_t* source, const cet_cs_vec_t* target, cons cs_name_from = (char*)cet_cs_vec_utf8.name; cs_name_to = (char*)target->name; } else { - if ((target != NULL) && (target != &cet_cs_vec_utf8)) { + if ((target != nullptr) && (target != &cet_cs_vec_utf8)) { fatal(MYNAME ": Internal error!\n"); } diff --git a/compegps.cc b/compegps.cc index 40405f1e9..ff7104dc0 100644 --- a/compegps.cc +++ b/compegps.cc @@ -92,19 +92,19 @@ static arglist_t compegps_args[] = { { "deficon", &option_icon, "Default icon name", - NULL, ARGTYPE_STRING, ARG_NOMINMAX + nullptr, ARGTYPE_STRING, ARG_NOMINMAX }, { "index", &option_index, "Index of route/track to write (if more than one in source)", - NULL, ARGTYPE_INT, "1", NULL + nullptr, ARGTYPE_INT, "1", nullptr }, { "radius", &option_radius, "Give points (waypoints/route points) a default radius (proximity)", - NULL, ARGTYPE_FLOAT, "0", NULL + nullptr, ARGTYPE_FLOAT, "0", nullptr }, { "snlen", &option_snlen, "Length of generated shortnames (default 16)", - "16", ARGTYPE_INT, "1", NULL + "16", ARGTYPE_INT, "1", nullptr }, ARG_TERMINATOR }; @@ -169,7 +169,7 @@ parse_wpt(char* buff) } c = csv_lineparse(buff, " ", "", col++); - while (c != NULL) { + while (c != nullptr) { c = lrtrim(c); if (*c != '\0') { #if 0 @@ -187,10 +187,10 @@ parse_wpt(char* buff) } break; case 2: - human_to_dec(c, &wpt->latitude, NULL, 1); + human_to_dec(c, &wpt->latitude, nullptr, 1); break; case 3: - human_to_dec(c, NULL, &wpt->longitude, 2); + human_to_dec(c, nullptr, &wpt->longitude, 2); break; // Older compegps used a dumb constant. // Report are that 2010-era writes a sensible @@ -221,7 +221,7 @@ parse_wpt(char* buff) } } } - c = csv_lineparse(NULL, " ", "", col++); + c = csv_lineparse(nullptr, " ", "", col++); } fix_datum(&wpt->latitude, &wpt->longitude); return wpt; @@ -235,7 +235,7 @@ parse_wpt_info(const char* buff, Waypoint* wpt) /* "w" */ double fx; c = csv_lineparse(buff, ",", "", col++); - while (c != NULL) { + while (c != nullptr) { c = lrtrim(c); if (*c != '\0') { #if 0 @@ -267,7 +267,7 @@ parse_wpt_info(const char* buff, Waypoint* wpt) /* "w" */ break; } } - c = csv_lineparse(NULL, ",", "", col++); + c = csv_lineparse(nullptr, ",", "", col++); } } @@ -286,7 +286,7 @@ parse_trkpt(char* buff) memset(&tm, 0, sizeof(tm)); c = csv_lineparse(buff, " ", "", col++); - while (c != NULL) { + while (c != nullptr) { c = lrtrim(c); if (*c != '\0') { #if 0 @@ -294,10 +294,10 @@ parse_trkpt(char* buff) #endif switch (col) { case 2: - human_to_dec(c, &wpt->latitude, NULL, 1); + human_to_dec(c, &wpt->latitude, nullptr, 1); break; case 3: - human_to_dec(c, NULL, &wpt->longitude, 2); + human_to_dec(c, nullptr, &wpt->longitude, 2); break; case 4: compegps_parse_date(c, &tm); @@ -311,7 +311,7 @@ parse_trkpt(char* buff) break; } } - c = csv_lineparse(NULL, " ", "", col++); + c = csv_lineparse(nullptr, " ", "", col++); } fix_datum(&wpt->latitude, &wpt->longitude); return wpt; @@ -324,7 +324,7 @@ parse_track_info(const char* buff, route_head* track) /* "t" */ int col = -1; c = csv_lineparse(buff, "|", "", col++); - while (c != NULL) { + while (c != nullptr) { c = lrtrim(c); if (*c != '\0') { #if 0 @@ -342,7 +342,7 @@ parse_track_info(const char* buff, route_head* track) /* "t" */ break; /* unknown field */ } } - c = csv_lineparse(NULL, "|", "", col++); + c = csv_lineparse(nullptr, "|", "", col++); } } @@ -353,7 +353,7 @@ parse_rte_info(const char* buff, route_head* route) /* "R" */ int col = -1; c = csv_lineparse(buff, ",", "", col++); - while (c != NULL) { + while (c != nullptr) { c = lrtrim(c); if (*c != '\0') { #if 0 @@ -370,7 +370,7 @@ parse_rte_info(const char* buff, route_head* route) /* "R" */ } } - c = csv_lineparse(NULL, ",", "", col++); + c = csv_lineparse(nullptr, ",", "", col++); } } @@ -395,9 +395,9 @@ compegps_data_read(void) char* buff; int line = 0; int input_datum; - Waypoint* wpt = NULL; - route_head* route = NULL; - route_head* track = NULL; + Waypoint* wpt = nullptr; + route_head* route = nullptr; + route_head* track = nullptr; while ((buff = gbfgetstr(fin))) { char* cin = buff; @@ -412,7 +412,7 @@ compegps_data_read(void) } ctail = strchr(cin, ' '); - if (ctail == NULL) { + if (ctail == nullptr) { continue; } ctail = lrtrim(ctail); @@ -443,8 +443,8 @@ compegps_data_read(void) break; case 'W': wpt = parse_wpt(ctail); - if (wpt != NULL) { - if (route != NULL) { + if (wpt != nullptr) { + if (route != nullptr) { route_add_wpt(route, wpt); } else { waypt_add(wpt); @@ -452,13 +452,13 @@ compegps_data_read(void) } break; case 'w': - is_fatal((wpt == NULL), MYNAME ": No waypoint data before \"%s\"!", cin); + is_fatal((wpt == nullptr), MYNAME ": No waypoint data before \"%s\"!", cin); parse_wpt_info(ctail, wpt); break; case 'T': wpt = parse_trkpt(ctail); - if (wpt != NULL) { - if (track == NULL) { + if (wpt != nullptr) { + if (track == nullptr) { track = route_head_alloc(); track_add_head(track); } @@ -466,7 +466,7 @@ compegps_data_read(void) } break; case 't': - if (track != NULL) { + if (track != nullptr) { parse_track_info(ctail, track); } break; @@ -498,13 +498,13 @@ write_waypt_cb(const Waypoint* wpt) fabs(wpt->longitude), 0xBA, (wpt->longitude >= 0) ? 'E' : 'W'); gbfprintf(fout, "27-MAR-62 00:00:00 %.6f", (wpt->altitude != unknown_alt) ? wpt->altitude : 0.0); - if (wpt->description != NULL) { + if (wpt->description != nullptr) { gbfprintf(fout, " %s", CSTRc(wpt->description)); } gbfprintf(fout, "\n"); if ((!wpt->icon_descr.isNull()) || (wpt->wpt_flags.proximity) || \ - (option_icon != NULL)) { + (option_icon != nullptr)) { gbfprintf(fout, "w %s,0,0.0,16777215,255,1,7,,%.1f\n", wpt->icon_descr.isNull() ? "Waypoint" : CSTR(wpt->icon_descr), WAYPT_GET(wpt, proximity, 0)); @@ -521,7 +521,7 @@ write_route_hdr_cb(const route_head* rte) } QString name = rte->rte_name; - if (name != NULL) { + if (name != nullptr) { name = csv_stringclean(name, ","); } else { name = " "; @@ -533,7 +533,7 @@ static void write_route(void) { curr_index = 0; - route_disp_all(write_route_hdr_cb, NULL, write_waypt_cb); + route_disp_all(write_route_hdr_cb, nullptr, write_waypt_cb); } static void @@ -555,7 +555,7 @@ write_trkpt_cb(const Waypoint* wpt) { char buff[128]; - if ((curr_index != target_index) || (wpt == NULL)) { + if ((curr_index != target_index) || (wpt == nullptr)) { return; } @@ -591,7 +591,7 @@ write_trkpt_cb(const Waypoint* wpt) -1.0); if (track_info_flag != 0) { track_info_flag = 0; - if (curr_track->rte_name != NULL) { + if (curr_track->rte_name != nullptr) { QString name = csv_stringclean(curr_track->rte_name, "|"); gbfprintf(fout, "t 4294967295|%s|-1|-1\n", CSTR(name)); } @@ -604,7 +604,7 @@ write_track(void) curr_index = 0; // gbfprintf(fout, "L +02:00:00\n"); - track_disp_all(write_track_hdr_cb, NULL, write_trkpt_cb); + track_disp_all(write_track_hdr_cb, nullptr, write_trkpt_cb); gbfprintf(fout, "F 1234\n"); } @@ -641,13 +641,13 @@ compegps_data_write(void) /* process options */ target_index = 1; - if (option_index != NULL) { + if (option_index != nullptr) { target_index = atoi(option_index); } snlen = 0; if (global_opts.synthesize_shortnames != 0) { - if (option_snlen != NULL) { + if (option_snlen != nullptr) { snlen = atoi(option_snlen); } else { snlen = SHORT_NAME_LENGTH; @@ -660,16 +660,16 @@ compegps_data_write(void) } radius = -1; - if (option_radius != 0) { + if (option_radius != nullptr) { radius = atof(option_radius); is_fatal((radius <= 0.0), MYNAME "Invalid value for radius!"); } - if (option_icon != NULL) { + if (option_icon != nullptr) { if (*option_icon == '\0') { - option_icon = NULL; + option_icon = nullptr; } else if (case_ignore_strcmp(option_icon, "deficon") == 0) { - option_icon = NULL; + option_icon = nullptr; } } @@ -702,7 +702,7 @@ ff_vecs_t compegps_vecs = { compegps_wr_deinit, compegps_data_read, compegps_data_write, - NULL, + nullptr, compegps_args, CET_CHARSET_MS_ANSI, 1 , NULL_POS_OPS, diff --git a/cst.cc b/cst.cc index ab8a0b050..5c57b6603 100644 --- a/cst.cc +++ b/cst.cc @@ -52,18 +52,18 @@ arglist_t cst_args[] = { static void cst_add_wpt(const route_head* track, Waypoint* wpt) { - if ((wpt == NULL) || (track == NULL)) { + if ((wpt == nullptr) || (track == nullptr)) { return; } - if (wpt->shortname != NULL) { + if (wpt->shortname != nullptr) { waypt_add(new Waypoint(*wpt)); // Rather than creating a new waypt on each read, tis format bizarrely // recycles the same one, relying on new waypoint(*) above and then manually // resetting fields. Weird. wpt->url_link_list_.clear(); - if (temp_route == NULL) { + if (temp_route == nullptr) { temp_route = route_head_alloc(); route_add_head(temp_route); } @@ -79,7 +79,7 @@ cst_make_url(char* str) char* res; if (len < 3) { - return NULL; + return nullptr; } if (strstr(str, "://") > str) { @@ -128,7 +128,7 @@ cst_make_url(char* str) return res; } else { - return NULL; + return nullptr; } } @@ -139,7 +139,7 @@ static void cst_rd_init(const QString& fname) { fin = gbfopen(fname, "rb", MYNAME); - temp_route = NULL; + temp_route = nullptr; } static void @@ -161,8 +161,8 @@ cst_data_read() int section = CST_UNKNOWN; int cst_version; int cst_points = -1; - route_head* track = NULL; - Waypoint* wpt = NULL; + route_head* track = nullptr; + Waypoint* wpt = nullptr; while ((buff = gbfgetstr(fin))) { char* cin = buff; @@ -228,7 +228,7 @@ cst_data_read() if (strcmp(cin + 2, "note") == 0) { buff = gbfgetstr(fin); - if (buff == NULL) { + if (buff == nullptr) { buff = (char*) ""; } line++; @@ -260,7 +260,7 @@ cst_data_read() } cst_add_wpt(track, wpt); - wpt = NULL; + wpt = nullptr; wpt = new Waypoint; @@ -304,7 +304,7 @@ cst_data_read() break; case CST_REFERENCE: - if ((strncmp(cin, "DATUM ", 6) == 0) && (strstr(cin, "WGS 84") == NULL)) { + if ((strncmp(cin, "DATUM ", 6) == 0) && (strstr(cin, "WGS 84") == nullptr)) { fatal(MYNAME ": Unsupported datum (%s)!\n", cin); } break; @@ -315,7 +315,7 @@ cst_data_read() } } cst_add_wpt(track, wpt); - wpt = NULL; + wpt = nullptr; if ((cst_points >= 0) && (data_lines != cst_points)) { warning(MYNAME ": Loaded %d point(s), but line %d says %d!\n", data_lines, line_of_count, cst_points); @@ -326,12 +326,12 @@ ff_vecs_t cst_vecs = { ff_type_file, { ff_cap_read, ff_cap_read, ff_cap_read }, cst_rd_init, - NULL, /* cst_wr_init, */ + nullptr, /* cst_wr_init, */ cst_rd_deinit, - NULL, /* cst_wr_deinit, */ + nullptr, /* cst_wr_deinit, */ cst_data_read, - NULL, /* cst_data_write, */ - NULL, + nullptr, /* cst_data_write, */ + nullptr, cst_args, CET_CHARSET_MS_ANSI, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/csv_util.cc b/csv_util.cc index c0f3af1c8..b5420d8e8 100644 --- a/csv_util.cc +++ b/csv_util.cc @@ -190,8 +190,8 @@ csv_stringclean(const QString& source, const QString& to_nuke) char* csv_stringtrim(const char* string, const char* enclosure, int strip_max) { - static const char* p1 = NULL; - char* p2 = NULL; + static const char* p1 = nullptr; + char* p2 = nullptr; char* tmp = xxstrdup(string,file,line); size_t elen; int stripped = 0; @@ -265,8 +265,8 @@ csv_lineparse(const char* stringstart, const char* delimited_by, const char* enclosed_in, const int line_no) { const char* sp; - static const char* p = NULL; - static char* tmp = NULL; + static const char* p = nullptr; + static char* tmp = nullptr; size_t dlen = 0, elen = 0, efound = 0; int enclosedepth = 0; short int dfound; @@ -274,7 +274,7 @@ csv_lineparse(const char* stringstart, const char* delimited_by, if (tmp) { xfree(tmp); - tmp = NULL; + tmp = nullptr; } if (strcmp(delimited_by, "\\w") == 0) { @@ -298,7 +298,7 @@ csv_lineparse(const char* stringstart, const char* delimited_by, if (!p) { /* last pass out */ - return (NULL); + return (nullptr); } } @@ -359,7 +359,7 @@ csv_lineparse(const char* stringstart, const char* delimited_by, p += dlen; } else { /* end of the line */ - p = NULL; + p = nullptr; } if (enclosedepth != 0) { @@ -482,7 +482,7 @@ human_to_dec(const char* instr, double* outlat, double* outlon, int which) int numind = 0; char* buff; - if (strchr(instr, ',') != NULL) { + if (strchr(instr, ',') != nullptr) { char* c; buff = xstrdup(instr); while ((c = strchr(buff, ','))) { @@ -639,10 +639,10 @@ human_to_dec(const char* instr, double* outlat, double* outlon, int which) QString dec_to_human(const char* format, const char* dirs, double val) { - char* subformat = NULL; - const char* formatptr = NULL; - char* percent = NULL; - char* type = NULL; + char* subformat = nullptr; + const char* formatptr = nullptr; + char* percent = nullptr; + char* type = nullptr; int index = 0; int intvals[3] = {0,0,0}; @@ -726,12 +726,12 @@ void xcsv_file_init(void) xcsv_file.badchars = QString(); xcsv_file.ifield_ct = 0; xcsv_file.ofield_ct = 0; - xcsv_file.file = NULL; - xcsv_file.stream = NULL; - xcsv_file.codec = NULL; + xcsv_file.file = nullptr; + xcsv_file.stream = nullptr; + xcsv_file.codec = nullptr; xcsv_file.fname = QString(); - xcsv_file.description = NULL; - xcsv_file.extension = NULL; + xcsv_file.description = nullptr; + xcsv_file.extension = nullptr; xcsv_file.prologue.clear(); xcsv_file.epilogue.clear(); @@ -754,7 +754,7 @@ void xcsv_file_init(void) XcsvFile::XcsvFile() { is_internal = false; ifield_ct = ofield_ct = 0; - extension = description = NULL; + extension = description = nullptr; // xcsv_file_init(); } @@ -941,7 +941,7 @@ writehms(const char* format, time_t t, int gmt) stmp = localtime(&t); } - if (stmp == NULL) { + if (stmp == nullptr) { stmp = &no_time; } @@ -968,7 +968,7 @@ static garmin_fs_t* gmsd_init(Waypoint* wpt) { garmin_fs_t* gmsd = GMSD_FIND(wpt); - if (gmsd == NULL) { + if (gmsd == nullptr) { gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } @@ -984,7 +984,7 @@ xcsv_parse_val(const char* s, Waypoint* wpt, const field_map_t* fmp, route_head** trk) { const char* enclosure = ""; - geocache_data* gc_data = NULL; + geocache_data* gc_data = nullptr; if (!fmp->printfc) { fatal(MYNAME ": xcsv style '%s' is missing format specifier", fmp->key); @@ -1122,7 +1122,7 @@ xcsv_parse_val(const char* s, Waypoint* wpt, const field_map_t* fmp, while (*ss && !isdigit(*ss)) { ss++; } - utm_northing = strtod(ss, NULL); + utm_northing = strtod(ss, nullptr); } break; /* ALTITUDE CONVERSIONS ************************************************/ @@ -1414,7 +1414,7 @@ xcsv_readline(char* buff) } QString line = xcsv_file.stream->readLine(); if (line.isNull()) { - return NULL; + return nullptr; } else { // TODO: move csv processing to Qt, eliminating the need to go // back to 8 bit encoding, which is shaky for encoding like utf8 @@ -1431,20 +1431,20 @@ xcsv_readline(char* buff) void xcsv_data_read(void) { - char* buff = NULL; + char* buff = nullptr; char* s; Waypoint* wpt_tmp; int linecount = 0; queue* elem; field_map_t* fmp; - route_head* rte = NULL; - route_head* trk = NULL; + route_head* rte = nullptr; + route_head* trk = nullptr; utm_northing = 0; utm_easting = 0; utm_zone = 0; utm_zonec = 'N'; - csv_route = csv_track = NULL; + csv_route = csv_track = nullptr; if (xcsv_file.datatype == trkdata) { csv_track = trk; } else if (xcsv_file.datatype == rtedata) { @@ -1500,12 +1500,12 @@ xcsv_data_read(void) if (elem == &xcsv_file.ifield) { /* we've wrapped the queue. so stop parsing! */ while (s) { - s=csv_lineparse(NULL, "\xff","",linecount); + s=csv_lineparse(nullptr, "\xff","",linecount); } break; } - s = csv_lineparse(NULL, CSTR(xcsv_file.field_delimiter), + s = csv_lineparse(nullptr, CSTR(xcsv_file.field_delimiter), CSTR(xcsv_file.field_encloser), linecount); } @@ -1526,7 +1526,7 @@ xcsv_data_read(void) if (link_) { wpt_tmp->AddUrlLink(*link_); delete link_; - link_ = NULL; + link_ = nullptr; } switch (xcsv_file.datatype) { @@ -1535,7 +1535,7 @@ xcsv_data_read(void) waypt_add(wpt_tmp); break; case trkdata: - if (trk == NULL) { + if (trk == nullptr) { trk = route_head_alloc(); csv_track = trk; track_add_head(trk); @@ -1543,7 +1543,7 @@ xcsv_data_read(void) track_add_wpt(trk, wpt_tmp); break; case rtedata: - if (rte == NULL) { + if (rte == nullptr) { rte = route_head_alloc(); csv_route = rte; route_add_head(rte); @@ -1563,7 +1563,7 @@ xcsv_resetpathlen(const route_head* head) pathdist = 0; oldlat = 999; oldlon = 999; - csv_route = csv_track = NULL; + csv_route = csv_track = nullptr; switch (xcsv_file.datatype) { case trkdata: csv_track = (route_head*) head; @@ -2080,7 +2080,7 @@ xcsv_waypt_pr(const Waypoint* wpt) field_is_unknown = !wpt->sat; break; case XT_GPS_FIX: { - const char* fix = NULL; + const char* fix = nullptr; switch (wpt->fix) { case fix_unknown: field_is_unknown = 1; diff --git a/delgpl.cc b/delgpl.cc index 6d52952c3..39d0fd3f2 100644 --- a/delgpl.cc +++ b/delgpl.cc @@ -159,7 +159,7 @@ gpl_trackpt(const Waypoint* wpt) static void gpl_write() { - track_disp_all(NULL, NULL, gpl_trackpt); + track_disp_all(nullptr, nullptr, gpl_trackpt); } ff_vecs_t gpl_vecs = { @@ -171,8 +171,8 @@ ff_vecs_t gpl_vecs = { gpl_wr_deinit, gpl_read, gpl_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_UTF8, 1 /* there is no need to convert anything | CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/destinator.cc b/destinator.cc index a5543bde2..807180434 100644 --- a/destinator.cc +++ b/destinator.cc @@ -50,7 +50,7 @@ static garmin_fs_t* gmsd_init(Waypoint* wpt) { garmin_fs_t* gmsd = GMSD_FIND(wpt); - if (gmsd == NULL) { + if (gmsd == nullptr) { gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } @@ -60,7 +60,7 @@ gmsd_init(Waypoint* wpt) static QString read_wcstr(const int discard) { - int16_t* buff = NULL, c; + int16_t* buff = nullptr, c; int size = 0, pos = 0; while (gbfread(&c, sizeof(c), 1, fin) && (c != 0)) { @@ -78,13 +78,13 @@ read_wcstr(const int discard) if (pos != 0) { char* res; if (discard) { - res = NULL; + res = nullptr; } else { res = cet_str_uni_to_utf8(buff, pos); res = lrtrim(res); if (*res == '\0') { xfree(res); - res = NULL; + res = nullptr; } } xfree(buff); @@ -93,7 +93,7 @@ read_wcstr(const int discard) return rv; //return res; } else { - return NULL; + return nullptr; } } @@ -225,7 +225,7 @@ static void destinator_read_rte() { int count = 0; - route_head* rte = NULL; + route_head* rte = nullptr; gbfrewind(fin); @@ -278,7 +278,7 @@ destinator_read_trk() { char TXT[4] = "TXT"; int recno = -1; - route_head* trk = NULL; + route_head* trk = nullptr; gbfrewind(fin); @@ -391,12 +391,12 @@ destinator_wpt_disp(const Waypoint* wpt) write_wcstr((!wpt->shortname.isEmpty()) ? wpt->shortname : "WPT"); write_wcstr((!wpt->notes.isEmpty()) ? wpt->notes : wpt->description); - write_wcstr(NULL); /* house number */ + write_wcstr(nullptr); /* house number */ write_wcstr(GMSD_GET(addr, NULL)); /* street */ write_wcstr(GMSD_GET(city, NULL)); /* city */ - write_wcstr(NULL); /* unknown */ + write_wcstr(nullptr); /* unknown */ write_wcstr(GMSD_GET(postal_code, NULL)); /* postcode */ - write_wcstr(NULL); /* unknown */ + write_wcstr(nullptr); /* unknown */ gbfputint32(0, fout); gbfputint32(0, fout); @@ -534,13 +534,13 @@ destinator_write_poi() static void destinator_write_rte() { - route_disp_all(NULL, NULL, destinator_rtept_disp); + route_disp_all(nullptr, nullptr, destinator_rtept_disp); } static void destinator_write_trk() { - track_disp_all(NULL, NULL, destinator_trkpt_disp); + track_disp_all(nullptr, nullptr, destinator_trkpt_disp); } /**************************************************************************/ @@ -558,7 +558,7 @@ ff_vecs_t destinator_poi_vecs = { destinator_wr_deinit, destinator_read_poi_wrapper, destinator_write_poi, - NULL, + nullptr, destinator_args, CET_CHARSET_UTF8, 1 /* fixed */ , NULL_POS_OPS, @@ -577,7 +577,7 @@ ff_vecs_t destinator_itn_vecs = { destinator_wr_deinit, destinator_read_rte_wrapper, destinator_write_rte, - NULL, + nullptr, destinator_args, CET_CHARSET_UTF8, 1 /* fixed */ , NULL_POS_OPS, @@ -596,7 +596,7 @@ ff_vecs_t destinator_trl_vecs = { destinator_wr_deinit, destinator_read_trk_wrapper, destinator_write_trk, - NULL, + nullptr, destinator_args, CET_CHARSET_UTF8, 1 /* fixed */ , NULL_POS_OPS, diff --git a/dg-100.cc b/dg-100.cc index 25c9733fe..b98d63505 100644 --- a/dg-100.cc +++ b/dg-100.cc @@ -120,7 +120,7 @@ dg100_findcmd(int id) { } } - return NULL; + return nullptr; } static void @@ -265,10 +265,10 @@ process_gpsfile(uint8_t data[], route_head** track) if ((i == 0) && (be_read32(data + i + 8) & 0x80000000)) { /* This is the first point recorded after power-on; start a new track */ - *track = NULL; + *track = nullptr; } - if (*track == NULL) { + if (*track == nullptr) { time_t creation_time; char buf[1024]; bintime = be_read32(data + i + 8) & 0x7FFFFFFF; @@ -413,7 +413,7 @@ dg100_recv_frame(struct dg100_command** cmdinfo_result, uint8_t** payload) /* consume input until frame head sequence 0xA0A2 was received */ frame_head = 0; - dg100_debug("Receiving ", 0, 0, NULL); + dg100_debug("Receiving ", 0, 0, nullptr); do { c = dg100_recv_byte(); dg100_debug("", 0, 1, &c); @@ -573,7 +573,7 @@ dg100_request(uint8_t cmd, const void* sendbuf, void* recvbuf, size_t count) uint8_t* buf; cmdinfo = dg100_findcmd(cmd); - assert(cmdinfo != NULL); + assert(cmdinfo != nullptr); dg100_send(cmd, sendbuf, cmdinfo->sendsize); /* the number of frames the answer will comprise */ @@ -638,7 +638,7 @@ dg100_getconfig() { uint8_t answer[45]; - dg100_request(dg100cmd_getconfig, NULL, answer, sizeof(answer)); + dg100_request(dg100cmd_getconfig, nullptr, answer, sizeof(answer)); } static void @@ -658,7 +658,7 @@ dg100_getfiles() unsigned int i; int filenum; struct dynarray16 headers; - route_head* track = NULL; + route_head* track = nullptr; /* maximum number of headers observed so far: 672 * if necessary, the dynarray will grow even further */ @@ -712,7 +712,7 @@ arglist_t dg100_args[] = { static void common_rd_init(const QString& fname) { - if (serial_handle = gbser_init(qPrintable(fname)), NULL == serial_handle) { + if (serial_handle = gbser_init(qPrintable(fname)), nullptr == serial_handle) { fatal(MYNAME ": Can't open port '%s'\n", qPrintable(fname)); } if (gbser_set_speed(serial_handle, model->speed) != gbser_OK) { @@ -743,7 +743,7 @@ static void dg100_rd_deinit() { gbser_deinit(serial_handle); - serial_handle = NULL; + serial_handle = nullptr; } static void @@ -771,12 +771,12 @@ ff_vecs_t dg100_vecs = { ff_cap_none /* routes */ }, dg100_rd_init, - NULL, + nullptr, dg100_rd_deinit, - NULL, + nullptr, dg100_read, - NULL, - NULL, + nullptr, + nullptr, dg100_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ @@ -792,12 +792,12 @@ ff_vecs_t dg200_vecs = { ff_cap_none /* routes */ }, dg200_rd_init, - NULL, + nullptr, dg100_rd_deinit, - NULL, + nullptr, dg100_read, - NULL, - NULL, + nullptr, + nullptr, dg100_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ diff --git a/discard.cc b/discard.cc index 91adb6604..2e1894700 100644 --- a/discard.cc +++ b/discard.cc @@ -28,21 +28,21 @@ #include #if FILTERS_ENABLED -static char* hdopopt = NULL; -static char* vdopopt = NULL; -static char* andopt = NULL; -static char* satopt = NULL; -static char* fixnoneopt = NULL; -static char* fixunknownopt = NULL; -static char* eleminopt = NULL; -static char* elemaxopt = NULL; -static char* nameopt = NULL; +static char* hdopopt = nullptr; +static char* vdopopt = nullptr; +static char* andopt = nullptr; +static char* satopt = nullptr; +static char* fixnoneopt = nullptr; +static char* fixunknownopt = nullptr; +static char* eleminopt = nullptr; +static char* elemaxopt = nullptr; +static char* nameopt = nullptr; static QRegExp name_regex; -static char* descopt = NULL; +static char* descopt = nullptr; static QRegExp desc_regex; -static char* cmtopt = NULL; +static char* cmtopt = nullptr; static QRegExp cmt_regex; -static char* iconopt = NULL; +static char* iconopt = nullptr; static QRegExp icon_regex; static double hdopf; @@ -65,7 +65,7 @@ arglist_t fix_args[] = { }, { "hdopandvdop", &andopt, "Link hdop and vdop supression with AND", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "sat", &satopt, "Minimium sats to keep points", @@ -73,39 +73,39 @@ arglist_t fix_args[] = { }, { "fixnone", &fixnoneopt, "Suppress points without fix", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "fixunknown", &fixunknownopt, "Suppress points with unknown fix", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "elemin", &eleminopt, "Suppress points below given elevation in meters", - NULL, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr }, { "elemax", &elemaxopt, "Suppress points above given elevation in meters", - NULL, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX, nullptr }, { "matchname", &nameopt, - "Suppress points where name matches given name", NULL, ARGTYPE_STRING, - ARG_NOMINMAX, NULL + "Suppress points where name matches given name", nullptr, ARGTYPE_STRING, + ARG_NOMINMAX, nullptr }, { "matchdesc", &descopt, - "Suppress points where description matches given name", NULL, ARGTYPE_STRING, - ARG_NOMINMAX, NULL + "Suppress points where description matches given name", nullptr, ARGTYPE_STRING, + ARG_NOMINMAX, nullptr }, { "matchcmt", &cmtopt, - "Suppress points where comment matches given name", NULL, ARGTYPE_STRING, - ARG_NOMINMAX, NULL + "Suppress points where comment matches given name", nullptr, ARGTYPE_STRING, + ARG_NOMINMAX, nullptr }, { "matchicon", &iconopt, - "Suppress points where type matches given name", NULL, ARGTYPE_STRING, - ARG_NOMINMAX, NULL + "Suppress points where type matches given name", nullptr, ARGTYPE_STRING, + ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -201,11 +201,11 @@ fix_process() // Filter tracks what = trkdata; - track_disp_all(fix_process_head, NULL, fix_process_wpt); + track_disp_all(fix_process_head, nullptr, fix_process_wpt); // And routes what = rtedata; - route_disp_all(fix_process_head, NULL, fix_process_wpt); + route_disp_all(fix_process_head, nullptr, fix_process_wpt); } @@ -263,8 +263,8 @@ fix_init(const char*) filter_vecs_t discard_vecs = { fix_init, fix_process, - NULL, - NULL, + nullptr, + nullptr, fix_args }; #endif diff --git a/dmtlog.cc b/dmtlog.cc index 83f621550..7dbef864e 100644 --- a/dmtlog.cc +++ b/dmtlog.cc @@ -53,7 +53,7 @@ static arglist_t dmtlog_args[] = { { "index", &opt_index, - "Index of track (if more than one in source)", "1", ARGTYPE_INT, "1", NULL + "Index of track (if more than one in source)", "1", ARGTYPE_INT, "1", nullptr }, ARG_TERMINATOR }; @@ -66,7 +66,7 @@ static xg_tag_mapping tlog3a_xgcb_map[] = { { tlog3a_xgcb_version, cb_cdata, "/CXMLSafe/Version" }, { tlog3a_xgcb_length, cb_cdata, "/CXMLSafe/Length" }, { tlog3a_xgcb_data, cb_cdata, "/CXMLSafe/Data" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; #endif @@ -97,7 +97,7 @@ static xg_tag_mapping tlog3b_xgcb_map[] = { { tlog3b_xgcb_wptno, cb_cdata, "/CTrackFile/CTrackPoint/Northing" }, { tlog3b_xgcb_wptal, cb_cdata, "/CTrackFile/CTrackPoint/Altitude" }, { tlog3b_xgcb_tpten, cb_end, "/CTrackFile/CTrackPoint" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; /* helpers */ @@ -215,7 +215,7 @@ tlog3a_xgcb_data(xg_string args, const QXmlStreamAttributes*) static void tlog3b_xgcb_tfna(xg_string args, const QXmlStreamAttributes*) { - if (xmltrk == NULL) { + if (xmltrk == nullptr) { xmltrk = route_head_alloc(); track_add_head(xmltrk); } @@ -226,7 +226,7 @@ tlog3b_xgcb_tfna(xg_string args, const QXmlStreamAttributes*) static void tlog3b_xgcb_tfdes(xg_string args, const QXmlStreamAttributes*) { - if (xmltrk == NULL) { + if (xmltrk == nullptr) { xmltrk = route_head_alloc(); track_add_head(xmltrk); } @@ -255,12 +255,12 @@ tlog3b_xgcb_tpten(xg_string, const QXmlStreamAttributes*) { finalize_pt(xmlwpt); - if (xmltrk == NULL) { + if (xmltrk == nullptr) { xmltrk = route_head_alloc(); track_add_head(xmltrk); } track_add_wpt(xmltrk, xmlwpt); - xmlwpt = NULL; + xmlwpt = nullptr; } @@ -326,7 +326,7 @@ tlog3b_xgcb_wpten(xg_string, const QXmlStreamAttributes*) { finalize_pt(xmlwpt); waypt_add(xmlwpt); - xmlwpt = NULL; + xmlwpt = nullptr; } @@ -587,7 +587,7 @@ inflate_buff(const char* buff, const size_t size, char** out_buff) int res = Z_OK; z_stream strm; char out[DEFLATE_BUFF_SIZE]; - char* cout = NULL; + char* cout = nullptr; uint32_t bytes = 0; uint32_t have; @@ -634,20 +634,20 @@ inflate_buff(const char* buff, const size_t size, char** out_buff) static void read_CXMLSafe() { - char* xmlstr = NULL; + char* xmlstr = nullptr; - xmlbin = NULL; + xmlbin = nullptr; xmlbinsize = 0; - xml_init(fin->name, tlog3a_xgcb_map, NULL); + xml_init(fin->name, tlog3a_xgcb_map, nullptr); xml_read(); xml_deinit(); - if (xmlbin != NULL) { + if (xmlbin != nullptr) { inflate_buff(xmlbin, xmlbinsize, &xmlstr); xfree(xmlbin); - xml_init(NULL, tlog3b_xgcb_map, NULL); + xml_init(nullptr, tlog3b_xgcb_map, nullptr); xml_readstring(xmlstr); xml_deinit(); @@ -660,7 +660,7 @@ read_CXMLSafe() static void read_XML() { - xml_init(fin->name, tlog3b_xgcb_map, NULL); + xml_init(fin->name, tlog3b_xgcb_map, nullptr); xml_read(); xml_deinit(); @@ -676,9 +676,9 @@ dmtlog_rd_init(const QString& fname) { fin = gbfopen_le(fname, "rb", MYNAME); - xmlbin = NULL; - xmltrk = NULL; - xmlwpt = NULL; + xmlbin = nullptr; + xmltrk = nullptr; + xmlwpt = nullptr; xmlgrid = QString(); } @@ -738,7 +738,7 @@ write_header(const route_head* trk) header_written = 1; count = 0; - if (trk != NULL) { + if (trk != nullptr) { queue* curr, *prev; QUEUE_FOR_EACH(&trk->waypoint_list, curr, prev) count++; } @@ -831,7 +831,7 @@ dmtlog_write() this_index = 0; track_disp_all(track_hdr_cb, track_tlr_cb, track_wpt_cb); if (!header_written) { - write_header(NULL); + write_header(nullptr); } gbfputint32(waypt_count(), fout); if (waypt_count() > 0) { @@ -856,7 +856,7 @@ ff_vecs_t dmtlog_vecs = { dmtlog_wr_deinit, dmtlog_read, dmtlog_write, - NULL, + nullptr, dmtlog_args, CET_CHARSET_ASCII, 0 , NULL_POS_OPS, diff --git a/duplicate.cc b/duplicate.cc index 88dd0f8b1..0e2781999 100644 --- a/duplicate.cc +++ b/duplicate.cc @@ -24,28 +24,28 @@ #include // qsort #if FILTERS_ENABLED -static char* snopt = NULL; -static char* lcopt = NULL; -static char* purge_duplicates = NULL; -static char* correct_coords = NULL; +static char* snopt = nullptr; +static char* lcopt = nullptr; +static char* purge_duplicates = nullptr; +static char* correct_coords = nullptr; static arglist_t dup_args[] = { { "shortname", &snopt, "Suppress duplicate waypoints based on name", - NULL, ARGTYPE_BEGIN_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "location", &lcopt, "Suppress duplicate waypoint based on coords", - NULL, ARGTYPE_END_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_END_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "all", &purge_duplicates, "Suppress all instances of duplicates", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "correct", &correct_coords, "Use coords from duplicate points", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -60,10 +60,10 @@ typedef struct btree_node { static btree_node* addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode) { - btree_node* tmp, * last = NULL; + btree_node* tmp, * last = nullptr; if (*oldnode) { - *oldnode = NULL; + *oldnode = nullptr; } if (!tree) { @@ -82,7 +82,7 @@ addnode(btree_node* tree, btree_node* newnode, btree_node** oldnode) if (oldnode) { *oldnode = tmp; } - return (NULL); + return (nullptr); } } @@ -176,15 +176,15 @@ static void duplicate_process(void) { Waypoint* waypointp; - btree_node* newnode, * btmp, * sup_tree = NULL; - btree_node* oldnode = NULL; + btree_node* newnode, * btmp, * sup_tree = nullptr; + btree_node* oldnode = nullptr; unsigned long crc = 0; struct { char shortname[32]; char lat[13]; char lon[13]; } dupe; - Waypoint* delwpt = NULL; + Waypoint* delwpt = nullptr; int i, ct = waypt_count(); wpt_ptr* htable, *bh; @@ -237,7 +237,7 @@ duplicate_process(void) btmp = addnode(sup_tree, newnode, &oldnode); - if (btmp == NULL) { + if (btmp == nullptr) { if (delwpt) { delete delwpt; } @@ -252,7 +252,7 @@ duplicate_process(void) if (oldnode->wpt) { waypt_del(oldnode->wpt); delete oldnode->wpt; - oldnode->wpt = NULL; + oldnode->wpt = nullptr; } } @@ -272,10 +272,10 @@ duplicate_process(void) } filter_vecs_t duplicate_vecs = { - NULL, + nullptr, duplicate_process, - NULL, - NULL, + nullptr, + nullptr, dup_args }; #endif diff --git a/easygps.cc b/easygps.cc index f9c697ba3..0fbb19226 100644 --- a/easygps.cc +++ b/easygps.cc @@ -221,7 +221,7 @@ ff_vecs_t easygps_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, easygps_args, CET_CHARSET_ASCII, 0 /* CET REVIEW */ , NULL_POS_OPS, diff --git a/energympro.cc b/energympro.cc index 54d50cfcc..b70cccdb5 100644 --- a/energympro.cc +++ b/energympro.cc @@ -214,7 +214,7 @@ rd_init(const QString& fname) gbfile* fileorg_in = gbfopen(fname, "rb", MYNAME); /* copy file to memory stream (needed for seek-ops and piped commands) */ - file_in = gbfopen(NULL, "wb", MYNAME); + file_in = gbfopen(nullptr, "wb", MYNAME); gbsize_t size; size = gbfcopyfrom(file_in, fileorg_in, 0x7FFFFFFF); if(global_opts.debug_level > 1) { @@ -305,13 +305,13 @@ ff_vecs_t energympro_vecs = { ff_cap_none // routes }, rd_init, // rd_init - NULL, // wr_init + nullptr, // wr_init rd_deinit, // rd_deinit - NULL, // wr_deinit + nullptr, // wr_deinit data_read, // read - NULL, // write - NULL, // exit - NULL, //args + nullptr, // write + nullptr, // exit + nullptr, //args CET_CHARSET_ASCII, 0 //encode,fixed_encode //NULL //name dynamic/internal? }; diff --git a/enigma.cc b/enigma.cc index f46a0dc66..1988cd6c1 100644 --- a/enigma.cc +++ b/enigma.cc @@ -179,11 +179,11 @@ enigma_waypt_disp(const Waypoint* wpt) if (wpt->altitude != unknown_alt) { le_write32(&ewpt.data.wp_altitude, METERS_TO_FEET(wpt->altitude) + 1000); } - if (wpt->shortname != NULL) { + if (wpt->shortname != nullptr) { ewpt.shortname_len = min(6, strlen(CSTRc(wpt->shortname))); strncpy(ewpt.shortname, CSTRc(wpt->shortname), 6); } - if (wpt->description != NULL) { + if (wpt->description != nullptr) { ewpt.longname_len = min(27, strlen(CSTRc(wpt->description))); strncpy(ewpt.longname, CSTRc(wpt->description), 27); } @@ -193,7 +193,7 @@ enigma_waypt_disp(const Waypoint* wpt) static void data_write() { - route_disp_all(NULL, NULL, enigma_waypt_disp); + route_disp_all(nullptr, nullptr, enigma_waypt_disp); } static void @@ -215,7 +215,7 @@ ff_vecs_t enigma_vecs = { wr_deinit, data_read, data_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ }; diff --git a/exif.cc b/exif.cc index e7f9add77..06a1e5bbe 100644 --- a/exif.cc +++ b/exif.cc @@ -144,8 +144,8 @@ static uint8_t writer_gps_tag_version[4] = {2, 0, 0, 0}; arglist_t exif_args[] = { { "filename", &opt_filename, "Set waypoint name to source filename", "Y", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, - { "frame", &opt_frame, "Time-frame (in seconds)", "10", ARGTYPE_INT, "0", NULL, nullptr }, - { "name", &opt_name, "Locate waypoint for tagging by this name", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + { "frame", &opt_frame, "Time-frame (in seconds)", "10", ARGTYPE_INT, "0", nullptr, nullptr }, + { "name", &opt_name, "Locate waypoint for tagging by this name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "overwrite", &opt_overwrite, "!OVERWRITE! the original file. Default=N", "N", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -314,7 +314,7 @@ exif_release_tag(exif_tag_t* tag) static void exif_release_ifd(exif_ifd_t* ifd) { - if (ifd != NULL) { + if (ifd != nullptr) { queue* elem, *tmp; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { @@ -371,14 +371,14 @@ exif_ifd_size(exif_ifd_t* ifd) static exif_app_t* exif_load_apps() { - exif_app_t* exif_app = NULL; + exif_app_t* exif_app = nullptr; while (! gbfeof(fin)) { exif_app_t* app = (exif_app_t*) xcalloc(sizeof(*app), 1); ENQUEUE_TAIL(&exif_apps, &app->Q); QUEUE_INIT(&app->ifds); - app->fcache = gbfopen(NULL, "wb", MYNAME); + app->fcache = gbfopen(nullptr, "wb", MYNAME); app->marker = gbfgetuint16(fin); app->len = gbfgetuint16(fin); @@ -570,20 +570,20 @@ exif_read_app(exif_app_t* app) offs = gbfgetuint32(fin); ifd = exif_read_ifd(app, IFD0, offs, &exif_ifd_ofs, &gps_ifd_ofs, &inter_ifd_ofs); - if (ifd == NULL) { + if (ifd == nullptr) { return; } if (ifd->next_ifd) { ifd = exif_read_ifd(app, IFD1, ifd->next_ifd, &exif_ifd_ofs, &gps_ifd_ofs, &inter_ifd_ofs); } if (exif_ifd_ofs) { - ifd = exif_read_ifd(app, EXIF_IFD, exif_ifd_ofs, NULL, NULL, &inter_ifd_ofs); + ifd = exif_read_ifd(app, EXIF_IFD, exif_ifd_ofs, nullptr, nullptr, &inter_ifd_ofs); } if (gps_ifd_ofs) { - ifd = exif_read_ifd(app, 3, gps_ifd_ofs, NULL, NULL, NULL); + ifd = exif_read_ifd(app, 3, gps_ifd_ofs, nullptr, nullptr, nullptr); } if (inter_ifd_ofs) { - ifd = exif_read_ifd(app, 4, inter_ifd_ofs, NULL, NULL, NULL); + ifd = exif_read_ifd(app, 4, inter_ifd_ofs, nullptr, nullptr, nullptr); } // The return values of exif_read_ifd above aren't actually used. // Warning hush. @@ -615,7 +615,7 @@ exif_examine_app(exif_app_t* app) } gbfseek(ftmp, 6, SEEK_SET); - app->fexif = gbfopen(NULL, "wb", MYNAME); + app->fexif = gbfopen(nullptr, "wb", MYNAME); app->fexif->big_endian = ftmp->big_endian; gbfcopyfrom(app->fexif, ftmp, 0x7FFFFFFF); @@ -634,14 +634,14 @@ exif_find_ifd(exif_app_t* app, const uint16_t ifd_nr) return ifd; } } - return NULL; + return nullptr; } static exif_tag_t* exif_find_tag(exif_app_t* app, const uint16_t ifd_nr, const uint16_t tag_id) { exif_ifd_t* ifd = exif_find_ifd(app, ifd_nr); - if (ifd != NULL) { + if (ifd != nullptr) { queue* elem, *tmp; QUEUE_FOR_EACH(&ifd->tags, elem, tmp) { exif_tag_t* tag = (exif_tag_t*)elem; @@ -650,7 +650,7 @@ exif_find_tag(exif_app_t* app, const uint16_t ifd_nr, const uint16_t tag_id) } } } - return NULL; + return nullptr; } static time_t @@ -689,7 +689,7 @@ exif_waypt_from_exif_app(exif_app_t* app) char lon_ref = '\0'; char alt_ref = 0; char speed_ref = 'K'; - char* datum = NULL; + char* datum = nullptr; char mode = '\0'; double gpsdop = unknown_alt; double alt = unknown_alt; @@ -697,8 +697,8 @@ exif_waypt_from_exif_app(exif_app_t* app) time_t datestamp = UNKNOWN_TIMESTAMP; ifd = exif_find_ifd(app, GPS_IFD); - if (ifd == NULL) { - return NULL; + if (ifd == nullptr) { + return nullptr; } wpt = new Waypoint; @@ -969,12 +969,12 @@ exif_dec2frac(double val, int32_t* num, int32_t* den) static exif_tag_t* exif_put_value(const int ifd_nr, const uint16_t tag_id, const uint16_t type, const uint32_t count, const int index, const void* data) { - exif_tag_t* tag = NULL; + exif_tag_t* tag = nullptr; exif_ifd_t* ifd; uint16_t item_size, size; ifd = exif_find_ifd(exif_app, ifd_nr); - if (ifd == NULL) { + if (ifd == nullptr) { ifd = (exif_ifd_t*) xcalloc(sizeof(*ifd), 1); ifd->nr = ifd_nr; QUEUE_INIT(&ifd->tags); @@ -985,15 +985,15 @@ exif_put_value(const int ifd_nr, const uint16_t tag_id, const uint16_t type, con item_size = exif_type_size(type); - if ((data == NULL) || (count < 1) || (index < 0)) { + if ((data == nullptr) || (count < 1) || (index < 0)) { size = 0; } else { size = (index + count) * item_size; } - if (tag == NULL) { + if (tag == nullptr) { if (size == 0) { - return NULL; + return nullptr; } tag = (exif_tag_t*) xcalloc(sizeof(*tag), 1); @@ -1011,7 +1011,7 @@ exif_put_value(const int ifd_nr, const uint16_t tag_id, const uint16_t type, con if (size == 0) { /* remove this element */ ifd->count--; exif_release_tag(tag); - return NULL; + return nullptr; } if (tag->count < (index + count)) { if (! tag->data_is_dynamic) { @@ -1095,7 +1095,7 @@ exif_put_long(const int ifd_nr, const int tag_id, const int index, const int32_t static void exif_remove_tag(const int ifd_nr, const int tag_id) { - exif_put_value(ifd_nr, tag_id, EXIF_TYPE_BYTE, 0, 0, NULL); + exif_put_value(ifd_nr, tag_id, EXIF_TYPE_BYTE, 0, 0, nullptr); } static void @@ -1105,7 +1105,7 @@ exif_find_wpt_by_time(const Waypoint* wpt) return; } - if (exif_wpt_ref == NULL) { + if (exif_wpt_ref == nullptr) { exif_wpt_ref = wpt; } else if (labs(exif_time_ref - wpt->creation_time.toTime_t()) < labs(exif_time_ref - exif_wpt_ref->creation_time.toTime_t())) { exif_wpt_ref = wpt; @@ -1115,9 +1115,9 @@ exif_find_wpt_by_time(const Waypoint* wpt) static void exif_find_wpt_by_name(const Waypoint* wpt) { - if (exif_wpt_ref != NULL) { + if (exif_wpt_ref != nullptr) { return; - } else if ((wpt->shortname != NULL) && (case_ignore_strcmp(wpt->shortname, opt_name) == 0)) { + } else if ((wpt->shortname != nullptr) && (case_ignore_strcmp(wpt->shortname, opt_name) == 0)) { exif_wpt_ref = wpt; } } @@ -1289,7 +1289,7 @@ exif_write_apps() sortqueue(&ifd->tags, exif_sort_tags_cb); } - ftmp = gbfopen_be(NULL, "wb", MYNAME); + ftmp = gbfopen_be(nullptr, "wb", MYNAME); ftmp->big_endian = app->fcache->big_endian; gbfwrite((ftmp->big_endian) ? "MM" : "II", 2, 1, ftmp); @@ -1364,7 +1364,7 @@ exif_read() is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file."); /* only jpeg for now */ exif_app = exif_load_apps(); - is_fatal(exif_app == NULL, MYNAME ": No EXIF header in source file \"%s\".", fin->name); + is_fatal(exif_app == nullptr, MYNAME ": No EXIF header in source file \"%s\".", fin->name); exif_examine_app(exif_app); wpt = exif_waypt_from_exif_app(exif_app); @@ -1389,7 +1389,7 @@ exif_wr_init(const QString& fname) soi = gbfgetuint16(fin); is_fatal(soi != 0xFFD8, MYNAME ": Unknown image file."); exif_app = exif_load_apps(); - is_fatal(exif_app == NULL, MYNAME ": No EXIF header found in source file \"%s\".", fin->name); + is_fatal(exif_app == nullptr, MYNAME ": No EXIF header found in source file \"%s\".", fin->name); exif_examine_app(exif_app); gbfclose(fin); @@ -1428,42 +1428,42 @@ exif_write() { time_t frame; - exif_wpt_ref = NULL; + exif_wpt_ref = nullptr; if (opt_name) { waypt_disp_all(exif_find_wpt_by_name); - if (exif_wpt_ref == NULL) { - route_disp_all(NULL, NULL, exif_find_wpt_by_name); + if (exif_wpt_ref == nullptr) { + route_disp_all(nullptr, nullptr, exif_find_wpt_by_name); } - if (exif_wpt_ref == NULL) { - track_disp_all(NULL, NULL, exif_find_wpt_by_name); + if (exif_wpt_ref == nullptr) { + track_disp_all(nullptr, nullptr, exif_find_wpt_by_name); } - if (exif_wpt_ref == NULL) { + if (exif_wpt_ref == nullptr) { warning(MYNAME ": No matching point with name \"%s\" found.\n", opt_name); } } else { QString str = exif_time_str(exif_time_ref); - track_disp_all(NULL, NULL, exif_find_wpt_by_time); - route_disp_all(NULL, NULL, exif_find_wpt_by_time); + track_disp_all(nullptr, nullptr, exif_find_wpt_by_time); + route_disp_all(nullptr, nullptr, exif_find_wpt_by_time); waypt_disp_all(exif_find_wpt_by_time); frame = atoi(opt_frame); - if (exif_wpt_ref == NULL) { + if (exif_wpt_ref == nullptr) { warning(MYNAME ": No point with a valid timestamp found.\n"); } else if (labs(exif_time_ref - exif_wpt_ref->creation_time.toTime_t()) > frame) { warning(MYNAME ": No matching point found for image date %s!\n", qPrintable(str)); - if (exif_wpt_ref != NULL) { + if (exif_wpt_ref != nullptr) { QString str = exif_time_str(exif_wpt_ref->creation_time.toTime_t()); warning(MYNAME ": Best is from %s, %ld second(s) away.\n", qPrintable(str), labs(exif_time_ref - exif_wpt_ref->creation_time.toTime_t())); } - exif_wpt_ref = NULL; + exif_wpt_ref = nullptr; } } - if (exif_wpt_ref != NULL) { + if (exif_wpt_ref != nullptr) { const Waypoint* wpt = exif_wpt_ref; exif_put_long(IFD0, IFD0_TAG_GPS_IFD_OFFS, 0, 0); @@ -1562,7 +1562,7 @@ ff_vecs_t exif_vecs = { exif_wr_deinit, exif_read, exif_write, - NULL, + nullptr, exif_args, CET_CHARSET_UTF8, 0 }; diff --git a/explorist_ini.cc b/explorist_ini.cc index 8a891dec0..889aa2c02 100644 --- a/explorist_ini.cc +++ b/explorist_ini.cc @@ -14,7 +14,7 @@ explorist_read_value(const char* section, const char* key) static mag_info* explorist_ini_try(const char* path) { - mag_info* info = NULL; + mag_info* info = nullptr; char* inipath; char* s; @@ -22,13 +22,13 @@ explorist_ini_try(const char* path) inifile = inifile_init(QString::fromUtf8(inipath), myname); if (!inifile) { xfree(inipath); - return NULL; + return nullptr; } info = (mag_info*) xmalloc(sizeof(mag_info)); - info->geo_path = NULL; - info->track_path = NULL; - info->waypoint_path = NULL; + info->geo_path = nullptr; + info->track_path = nullptr; + info->waypoint_path = nullptr; s = xstrdup(inifile_readstr(inifile, "UGDS", "WpFolder")); if (s) { @@ -54,7 +54,7 @@ explorist_ini_try(const char* path) mag_info* explorist_ini_get(const char** dirlist) { - mag_info* r = NULL; + mag_info* r = nullptr; while (dirlist && *dirlist) { r = explorist_ini_try(*dirlist); if (r) { diff --git a/f90g_track.cc b/f90g_track.cc index 272204c93..3ec02e1b8 100644 --- a/f90g_track.cc +++ b/f90g_track.cc @@ -37,8 +37,8 @@ -static gbfile* fin = NULL; -static route_head* track = NULL; +static gbfile* fin = nullptr; +static route_head* track = nullptr; static @@ -69,7 +69,7 @@ f90g_track_rd_init(const QString& fname) } // start the track list track = route_head_alloc(); - is_fatal((track == NULL), MYNAME ": memory non-enough"); + is_fatal((track == nullptr), MYNAME ": memory non-enough"); track->rte_name = fname; track_add_head(track); } @@ -93,7 +93,7 @@ f90g_track_read() int year, mon, mday, hour, min, sec, latitudeDeg, latitudeMin, longitudeDeg, longitudeMin, velocity; QDateTime dt; - is_fatal((track == NULL), MYNAME "Track setup error"); + is_fatal((track == nullptr), MYNAME "Track setup error"); for (;;) { if ((gbfread((void*)ttRec, 1, 2, fin) != 2) || (memcmp(ttRec,"TT",2))) { @@ -147,12 +147,12 @@ ff_vecs_t f90g_track_vecs = { ff_type_file, { ff_cap_none, (ff_cap)(ff_cap_read), ff_cap_none }, f90g_track_rd_init, - NULL, + nullptr, f90g_track_rd_deinit, - NULL, + nullptr, f90g_track_read, - NULL, - NULL, + nullptr, + nullptr, f90g_track_args, CET_CHARSET_UTF8, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ diff --git a/filter_vecs.cc b/filter_vecs.cc index 9669de303..98edd08ae 100644 --- a/filter_vecs.cc +++ b/filter_vecs.cc @@ -155,9 +155,9 @@ fl_vecs_t filter_vec_list[] = { }, #endif { - NULL, - NULL, - NULL + nullptr, + nullptr, + nullptr } }; @@ -184,10 +184,10 @@ find_filter_vec(const char* const vecname, const char** opts) const char* temp; temp = inifile_readstr(global_opts.inifile, vec->name, ap->argstring); - if (temp == NULL) { + if (temp == nullptr) { temp = inifile_readstr(global_opts.inifile, "Common filter settings", ap->argstring); } - if (temp == NULL) { + if (temp == nullptr) { temp = ap->defaultvalue; } assign_option(vec->name, ap, temp); @@ -212,7 +212,7 @@ find_filter_vec(const char* const vecname, const char** opts) } } } else { - *opts = NULL; + *opts = nullptr; } if (opts && opts[0] && !found) { warning("'%s' is an unknown option to %s.\n", *opts, vec->name); @@ -227,7 +227,7 @@ find_filter_vec(const char* const vecname, const char** opts) } xfree(v); - return NULL; + return nullptr; } void @@ -239,7 +239,7 @@ free_filter_vec(filter_vecs_t* fvec) for (ap = fvec->args; ap->argstring; ap++) { if (ap->argvalptr) { xfree(ap->argvalptr); - ap->argvalptr = *ap->argval = NULL; + ap->argvalptr = *ap->argval = nullptr; } } } @@ -253,7 +253,7 @@ init_filter_vecs() arglist_t* ap; if (vec->vec->args) { for (ap = vec->vec->args; ap->argstring; ap++) { - ap->argvalptr = NULL; + ap->argvalptr = nullptr; } } vec++; @@ -338,7 +338,7 @@ disp_v1(const fl_vecs_t* vec) { arglist_t* ap; - disp_help_url(vec, NULL); + disp_help_url(vec, nullptr); printf("\n"); for (ap = vec->vec->args; ap && ap->argstring; ap++) { if (!(ap->argtype & ARGTYPE_HIDDEN)) { diff --git a/formspec.cc b/formspec.cc index 2974aa116..1fcd1101d 100644 --- a/formspec.cc +++ b/formspec.cc @@ -23,13 +23,13 @@ format_specific_data* fs_chain_copy(format_specific_data* source) { - format_specific_data* result = NULL; + format_specific_data* result = nullptr; format_specific_data** copy = &result; while (source) { source->copy((void**)copy, (void*)source); /* prevent segfaults from badly-behaved copy functions */ - (*copy)->next = NULL; + (*copy)->next = nullptr; copy = &((*copy)->next); source = source->next; } @@ -39,7 +39,7 @@ format_specific_data* fs_chain_copy(format_specific_data* source) void fs_chain_destroy(format_specific_data* chain) { format_specific_data* cur = chain; - format_specific_data* next = NULL; + format_specific_data* next = nullptr; while (cur) { next = cur->next; cur->destroy(cur); @@ -56,7 +56,7 @@ format_specific_data* fs_chain_find(format_specific_data* chain, long type) } cur = cur->next; } - return NULL; + return nullptr; } void fs_chain_add(format_specific_data** chain, format_specific_data* data) diff --git a/g7towin.cc b/g7towin.cc index 775de5a66..16cfef3b6 100644 --- a/g7towin.cc +++ b/g7towin.cc @@ -80,7 +80,7 @@ parse_line(char* buff, int index, const char* delimiter, Waypoint* wpt) while ((cin = csv_lineparse(buff, delimiter, "", index++))) { - buff = NULL; + buff = nullptr; cin = lrtrim(cin); if ((*cin == '\0') || @@ -105,7 +105,7 @@ parse_line(char* buff, int index, const char* delimiter, Waypoint* wpt) memset(&tm, 0, sizeof(tm)); cerr = strptime(cin, "%a %b %d %H:%M:%S %Y", &tm); - if (cerr == NULL) { + if (cerr == nullptr) { fatal(MYNAME ": Unable to convert date (%s)!\n", cin); } wpt->SetCreationTime(mkgmtime(&tm)); @@ -316,7 +316,7 @@ parse_waypt(char* buff) memset(&tm, 0, sizeof(tm)); cerr = strptime(buff, "%a %b %d %H:%M:%S %Y", &tm); - if (cerr == NULL) { + if (cerr == nullptr) { fatal(MYNAME ": Unable to convert date (%s)!\n", buff); } wpt->SetCreationTime(mkgmtime(&tm)); @@ -330,10 +330,10 @@ parse_waypt(char* buff) buff++; } } - if (gardown && (buff == NULL)) { + if (gardown && (buff == nullptr)) { return wpt; } - is_fatal((buff == NULL), MYNAME ": Incomplete waypoint line!"); + is_fatal((buff == nullptr), MYNAME ": Incomplete waypoint line!"); while (isspace(*buff)) { buff++; @@ -374,7 +374,7 @@ parse_categories(char* buff) while ((cin = csv_lineparse(buff, ",", "", cat++))) { uint16_t cx; - buff = NULL; + buff = nullptr; cin = lrtrim(cin); if (*cin == 0) { @@ -412,8 +412,8 @@ data_read(void) { char* buff; int line = 0; - Waypoint* wpt = NULL; - route_head* head = NULL; + Waypoint* wpt = nullptr; + route_head* head = nullptr; while ((buff = gbfgetstr(fin))) { char* cin = buff; @@ -519,7 +519,7 @@ data_read(void) break; case 'L': - waypt_add_url(wpt, xstrdup(cdata), NULL); + waypt_add_url(wpt, xstrdup(cdata), nullptr); break; default: @@ -587,12 +587,12 @@ ff_vecs_t g7towin_vecs = { ff_type_file, { ff_cap_read, ff_cap_read, ff_cap_read }, rd_init, - NULL, + nullptr, rd_deinit, - NULL, + nullptr, data_read, - NULL, - NULL, + nullptr, + nullptr, g7towin_args, CET_CHARSET_MS_ANSI, 0 , NULL_POS_OPS, diff --git a/garmin.cc b/garmin.cc index ee539be15..2eeb9d802 100644 --- a/garmin.cc +++ b/garmin.cc @@ -42,16 +42,16 @@ static GPS_PWay* cur_tx_routelist_entry; static GPS_PTrack* tx_tracklist; static GPS_PTrack* cur_tx_tracklist_entry; static int my_track_count = 0; -static char* getposn = NULL; -static char* poweroff = NULL; -static char* eraset = NULL; -static char* resettime = NULL; -static char* snlen = NULL; -static char* snwhiteopt = NULL; -static char* deficon = NULL; -static char* category = NULL; -static char* categorybitsopt = NULL; -static char* baudopt = NULL; +static char* getposn = nullptr; +static char* poweroff = nullptr; +static char* eraset = nullptr; +static char* resettime = nullptr; +static char* snlen = nullptr; +static char* snwhiteopt = nullptr; +static char* deficon = nullptr; +static char* category = nullptr; +static char* categorybitsopt = nullptr; +static char* baudopt = nullptr; static int baud = 0; static int categorybits; static int receiver_must_upper = 1; @@ -66,41 +66,41 @@ static const char* valid_waypt_chars = MILITANT_VALID_WAYPT_CHARS " "; static arglist_t garmin_args[] = { { - "snlen", &snlen, "Length of generated shortnames", NULL, - ARGTYPE_INT, "1", NULL, nullptr + "snlen", &snlen, "Length of generated shortnames", nullptr, + ARGTYPE_INT, "1", nullptr, nullptr }, { "snwhite", &snwhiteopt, "Allow whitespace synth. shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, - { "deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + { "deficon", &deficon, "Default icon name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "get_posn", &getposn, "Return current position as a waypoint", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "power_off", &poweroff, "Command unit to power itself down", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "erase_t", &eraset, "Erase existing courses when writing new ones", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "resettime", &resettime, "Sync GPS time to computer time", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "category", &category, "Category number to use for written waypoints", - NULL, ARGTYPE_INT, "1", "16", nullptr + nullptr, ARGTYPE_INT, "1", "16", nullptr }, { "bitscategory", &categorybitsopt, "Bitmap of categories", - NULL, ARGTYPE_INT, "1", "65535", nullptr + nullptr, ARGTYPE_INT, "1", "65535", nullptr }, { "baud", &baudopt, "Speed in bits per second of serial port (baud=9600)", - NULL, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, + nullptr, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -114,7 +114,7 @@ rw_init(const QString& fname) { int receiver_short_length; int receiver_must_upper = 1; - const char* receiver_charset = NULL; + const char* receiver_charset = nullptr; if (!mkshort_handle) { mkshort_handle = mkshort_new_handle(); @@ -145,11 +145,11 @@ rw_init(const QString& fname) } if (categorybitsopt) { - categorybits = strtol(categorybitsopt, NULL, 0); + categorybits = strtol(categorybitsopt, nullptr, 0); } if (baudopt) { - baud = strtol(baudopt, NULL, 0); + baud = strtol(baudopt, nullptr, 0); switch (baud) { case 9600: case 19200: @@ -330,12 +330,12 @@ static void rd_init(const QString& fname) { if (setjmp(gdx_jmp_buf)) { - const char* vec_opts = NULL; + const char* vec_opts = nullptr; const gdx_info* gi = gdx_get_info(); gpx_vec = find_vec("gpx", &vec_opts); gpx_vec->rd_init(gi->from_device.canon); } else { - gpx_vec = NULL; + gpx_vec = nullptr; rw_init(fname); } } @@ -354,7 +354,7 @@ rw_deinit() } xfree(portname); - portname = NULL; + portname = nullptr; } static int @@ -373,7 +373,7 @@ static void waypt_read() { int i,n; - GPS_PWay* way = NULL; + GPS_PWay* way = nullptr; if (getposn) { Waypoint* wpt = new Waypoint; @@ -447,7 +447,7 @@ unsigned int checkWayPointIsAtSplit(Waypoint* wpt, GPS_PLap* laps, int nlaps) { int result = 0; - if ((laps != NULL) && (nlaps > 0)) { + if ((laps != nullptr) && (nlaps > 0)) { int i; for (i=(nlaps-1); i >= 0; i--) { GPS_PLap lap = laps[i]; @@ -476,11 +476,11 @@ track_read() { int32 ntracks; GPS_PTrack* array; - route_head* trk_head = NULL; + route_head* trk_head = nullptr; int trk_num = 0; int i; const char* trk_name = ""; - GPS_PLap* laps = NULL; + GPS_PLap* laps = nullptr; int nlaps = 0; int next_is_new_trkseg = 0; @@ -510,7 +510,7 @@ track_read() } } - if (trk_head == NULL || array[i]->ishdr) { + if (trk_head == nullptr || array[i]->ishdr) { trk_head = route_head_alloc(); trk_head->rte_num = trk_num; trk_head->rte_name = trk_name; @@ -569,7 +569,7 @@ route_read() * RJL: No, the warning isn't right; GCC's flow analysis is broken. * still, it's good taste... */ - route_head* rte_head = NULL; + route_head* rte_head = nullptr; nroutepts = GPS_Command_Get_Route(portname, &array); @@ -577,7 +577,7 @@ route_read() #if 1 for (i = 0; i < nroutepts; i++) { if (array[i]->isrte) { - char* csrc = NULL; + char* csrc = nullptr; /* What a horrible API has libjeeps for making this * my problem. */ @@ -813,7 +813,7 @@ pvt_read(posn_status* posn_status) delete wpt; GPS_Pvt_Del(&pvt); - return NULL; + return nullptr; } static void @@ -1272,10 +1272,10 @@ ff_vecs_t garmin_vecs = { rw_deinit, data_read, data_write, - NULL, + nullptr, garmin_args, CET_CHARSET_ASCII, 0, - { pvt_init, pvt_read, rw_deinit, NULL, NULL, NULL }, + { pvt_init, pvt_read, rw_deinit, nullptr, nullptr, nullptr }, nullptr }; diff --git a/garmin_device_xml.cc b/garmin_device_xml.cc index 75c991b00..800aa3a07 100644 --- a/garmin_device_xml.cc +++ b/garmin_device_xml.cc @@ -100,17 +100,17 @@ void dir_s(xg_string args, const QXmlStreamAttributes*) if (base) { xfree(base) ; } - base = NULL; + base = nullptr; if (ext) { xfree(ext) ; } - ext = NULL; + ext = nullptr; if (path) { xfree(path) ; } - path = NULL; + path = nullptr; } static xg_tag_mapping gdx_map[] = { @@ -121,7 +121,7 @@ static xg_tag_mapping gdx_map[] = { { ext_s, cb_cdata, "/Device/MassStorageMode/DataType/File/Location/FileExtension" }, { base_s, cb_cdata, "/Device/MassStorageMode/DataType/File/Location/BaseName" }, { dir_s, cb_cdata, "/Device/MassStorageMode/DataType/File/TransferDirection" }, - { 0, (xg_cb_type) 0, NULL } + { nullptr, (xg_cb_type) 0, nullptr } }; const gdx_info* @@ -129,7 +129,7 @@ gdx_read(const char* fname) { // Test file open-able before gb_open gets a chance to fatal(). if (QFile(fname).open(QIODevice::ReadOnly)) { - xml_init(fname, gdx_map, NULL); + xml_init(fname, gdx_map, nullptr); xml_read(); xml_deinit(); } @@ -154,7 +154,7 @@ gdx_find_file(char** dirlist) } dirlist++; } - return NULL; + return nullptr; } const gdx_info* diff --git a/garmin_fit.cc b/garmin_fit.cc index 03a1e4fa9..b8d7b3810 100644 --- a/garmin_fit.cc +++ b/garmin_fit.cc @@ -60,7 +60,7 @@ const int kFieldEnhancedAltitude = 78; // For developer fields as a non conflicting id const int kFieldInvalid = 255; -static char* opt_allpoints = NULL; +static char* opt_allpoints = nullptr; static int lap_ct = 0; static @@ -68,7 +68,7 @@ arglist_t fit_args[] = { { "allpoints", &opt_allpoints, "Read all points even if latitude or longitude is missing", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -116,7 +116,7 @@ fit_rd_deinit() fit_message_def* def = &fit_data.message_def[local_id]; if (def->fields) { xfree(def->fields); - def->fields = NULL; + def->fields = nullptr; } } @@ -747,12 +747,12 @@ ff_vecs_t format_fit_vecs = { ff_cap_none /* routes */ }, fit_rd_init, - NULL, + nullptr, fit_rd_deinit, - NULL, + nullptr, fit_read, - NULL, - NULL, + nullptr, + nullptr, fit_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ diff --git a/garmin_fs.cc b/garmin_fs.cc index 0e648b278..ef292dcb5 100644 --- a/garmin_fs.cc +++ b/garmin_fs.cc @@ -35,14 +35,14 @@ garmin_fs_t* garmin_fs_alloc(const int protocol) { - garmin_fs_t* result = NULL; + garmin_fs_t* result = nullptr; result = (garmin_fs_t*)xcalloc(1, sizeof(*result)); result->fs.type = FS_GMSD; result->fs.copy = (fs_copy) garmin_fs_copy; result->fs.destroy = garmin_fs_destroy; result->fs.convert = garmin_fs_convert; - result->fs.next = NULL; + result->fs.next = nullptr; result->protocol = protocol; @@ -53,50 +53,50 @@ void garmin_fs_destroy(void* fs) { garmin_fs_t* data = (garmin_fs_t*) fs; - if (data != NULL) { + if (data != nullptr) { garmin_ilink_t* ilinks; - if (data->addr != NULL) { + if (data->addr != nullptr) { xfree(data->addr); } - if (data->cc != NULL) { + if (data->cc != nullptr) { xfree(data->cc); } - if (data->city != NULL) { + if (data->city != nullptr) { xfree(data->city); } - if (data->country != NULL) { + if (data->country != nullptr) { xfree(data->country); } - if (data->cross_road != NULL) { + if (data->cross_road != nullptr) { xfree(data->cross_road); } - if (data->facility != NULL) { + if (data->facility != nullptr) { xfree(data->facility); } - if (data->phone_nr != NULL) { + if (data->phone_nr != nullptr) { xfree(data->phone_nr); } - if (data->phone_nr2 != NULL) { + if (data->phone_nr2 != nullptr) { xfree(data->phone_nr2); } - if (data->fax_nr != NULL) { + if (data->fax_nr != nullptr) { xfree(data->fax_nr); } - if (data->email != NULL) { + if (data->email != nullptr) { xfree(data->email); } - if (data->postal_code != NULL) { + if (data->postal_code != nullptr) { xfree(data->postal_code); } - if (data->state != NULL) { + if (data->state != nullptr) { xfree(data->state); } - if ((ilinks = data->ilinks) != NULL) { + if ((ilinks = data->ilinks) != nullptr) { ilinks->ref_count--; if (ilinks->ref_count <= 0) { - while (ilinks != NULL) { + while (ilinks != nullptr) { garmin_ilink_t* tmp = ilinks; ilinks = ilinks->next; xfree(tmp); @@ -109,31 +109,31 @@ garmin_fs_destroy(void* fs) void garmin_fs_copy(garmin_fs_t** dest, garmin_fs_t* src) { - if (src == NULL) { - *dest = NULL; + if (src == nullptr) { + *dest = nullptr; return; } *dest = (garmin_fs_t*) xmalloc(sizeof(*src)); /* do not copy interlinks, only increment the refrence counter */ - if (src->ilinks != NULL) { + if (src->ilinks != nullptr) { src->ilinks->ref_count++; } memcpy(*dest, src, sizeof(*src)); - (*dest)->addr = (src->addr != NULL) ? xstrdup(src->addr) : NULL; - (*dest)->cc = (src->cc != NULL) ? xstrdup(src->cc) : NULL; - (*dest)->city = (src->city != NULL) ? xstrdup(src->city) : NULL; - (*dest)->country = (src->country != NULL) ? xstrdup(src->country) : NULL; - (*dest)->cross_road = (src->cross_road != NULL) ? xstrdup(src->cross_road) : NULL; - (*dest)->facility = (src->facility != NULL) ? xstrdup(src->facility) : NULL; - (*dest)->phone_nr = (src->phone_nr != NULL) ? xstrdup(src->phone_nr) : NULL; - (*dest)->phone_nr2 = (src->phone_nr2 != NULL) ? xstrdup(src->phone_nr2) : NULL; - (*dest)->fax_nr = (src->fax_nr != NULL) ? xstrdup(src->fax_nr) : NULL; - (*dest)->email = (src->email != NULL) ? xstrdup(src->email) : NULL; - (*dest)->postal_code = (src->postal_code != NULL) ? xstrdup(src->postal_code) : NULL; - (*dest)->state = (src->state != NULL) ? xstrdup(src->state) : NULL; + (*dest)->addr = (src->addr != nullptr) ? xstrdup(src->addr) : nullptr; + (*dest)->cc = (src->cc != nullptr) ? xstrdup(src->cc) : nullptr; + (*dest)->city = (src->city != nullptr) ? xstrdup(src->city) : nullptr; + (*dest)->country = (src->country != nullptr) ? xstrdup(src->country) : nullptr; + (*dest)->cross_road = (src->cross_road != nullptr) ? xstrdup(src->cross_road) : nullptr; + (*dest)->facility = (src->facility != nullptr) ? xstrdup(src->facility) : nullptr; + (*dest)->phone_nr = (src->phone_nr != nullptr) ? xstrdup(src->phone_nr) : nullptr; + (*dest)->phone_nr2 = (src->phone_nr2 != nullptr) ? xstrdup(src->phone_nr2) : nullptr; + (*dest)->fax_nr = (src->fax_nr != nullptr) ? xstrdup(src->fax_nr) : nullptr; + (*dest)->email = (src->email != nullptr) ? xstrdup(src->email) : nullptr; + (*dest)->postal_code = (src->postal_code != nullptr) ? xstrdup(src->postal_code) : nullptr; + (*dest)->state = (src->state != nullptr) ? xstrdup(src->state) : nullptr; } void garmin_fs_convert(void* fs) @@ -187,7 +187,7 @@ garmin_fs_xml_fprint(const Waypoint* waypt, const char* phone, *addr; garmin_fs_t* gmsd = GMSD_FIND(waypt); - if (gmsd == NULL) { + if (gmsd == nullptr) { return; } @@ -293,7 +293,7 @@ garmin_fs_xml_convert(const int base_tag, int tag, const QString& Qcdatastr, Way // FIXME: eliminate C string copy/use here: const char *cdatastr = xstrdup(Qcdatastr); gmsd = GMSD_FIND(waypt); - if (gmsd == NULL) { + if (gmsd == nullptr) { gmsd = garmin_fs_alloc(-1); fs_chain_add(&waypt->fs, (format_specific_data*) gmsd); } @@ -382,7 +382,7 @@ garmin_fs_convert_category(const char* category_name, uint16_t* category) (1 == sscanf(category_name + 9, "%d", &i)) && (i >= 1) && (i <= 16)) { cat = (1 << --i); - } else if (global_opts.inifile != NULL) { + } else if (global_opts.inifile != nullptr) { // Do we have a gpsbabel.ini that maps category names to category #'s? for (i = 0; i < 16; i++) { char* c; @@ -390,7 +390,7 @@ garmin_fs_convert_category(const char* category_name, uint16_t* category) snprintf(key, sizeof(key), "%d", i + 1); c = inifile_readstr(global_opts.inifile, GMSD_SECTION_CATEGORIES, key); - if ((c != NULL) && (case_ignore_strcmp(c, category_name) == 0)) { + if ((c != nullptr) && (case_ignore_strcmp(c, category_name) == 0)) { cat = (1 << i); break; } @@ -418,7 +418,7 @@ garmin_fs_merge_category(const char* category_name, Waypoint* waypt) gmsd = GMSD_FIND(waypt); cat = cat | (GMSD_GET(category, 0)); - if (gmsd == NULL) { + if (gmsd == nullptr) { gmsd = garmin_fs_alloc(-1); fs_chain_add(&waypt->fs, (format_specific_data*) gmsd); } @@ -429,7 +429,7 @@ garmin_fs_merge_category(const char* category_name, Waypoint* waypt) void garmin_fs_garmin_after_read(const GPS_PWay way, Waypoint* wpt, const int protoid) { - garmin_fs_t* gmsd = NULL; + garmin_fs_t* gmsd = nullptr; gmsd = garmin_fs_alloc(protoid); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); @@ -468,7 +468,7 @@ garmin_fs_garmin_before_write(const Waypoint* wpt, GPS_PWay way, const int proto (void)protoid; // unused for now. - if (gmsd == NULL) { + if (gmsd == nullptr) { return; } diff --git a/garmin_gpi.cc b/garmin_gpi.cc index 99c6fad62..1883082cb 100644 --- a/garmin_gpi.cc +++ b/garmin_gpi.cc @@ -77,11 +77,11 @@ static int alerts; static arglist_t garmin_gpi_args[] = { { "alerts", &opt_alerts, "Enable alerts on speed or proximity distance", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "bitmap", &opt_bitmap, "Use specified bitmap on output", - NULL, ARGTYPE_FILE, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FILE, ARG_NOMINMAX, nullptr }, { "category", &opt_cat, "Default category on output", @@ -89,31 +89,31 @@ static arglist_t garmin_gpi_args[] = { }, { "hide", &opt_hide_bitmap, "Don't show gpi bitmap on device", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "descr", &opt_descr, "Write description to address field", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "notes", &opt_notes, "Write notes to address field", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "position", &opt_pos, "Write position to address field", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "proximity", &opt_proximity, "Default proximity", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "sleep", &opt_sleep, "After output job done sleep n second(s)", - NULL, ARGTYPE_INT, "1", NULL, nullptr + nullptr, ARGTYPE_INT, "1", nullptr, nullptr }, { "speed", &opt_speed, "Default speed", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "unique", &opt_unique, "Create unique waypoint names (default = yes)", @@ -129,7 +129,7 @@ static arglist_t garmin_gpi_args[] = { }, { "languagecode", &opt_lang, "language code to use for reading dual language files", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -233,10 +233,10 @@ static garmin_fs_t* gpi_gmsd_init(Waypoint* wpt) { garmin_fs_t* gmsd = GMSD_FIND(wpt); - if (wpt == NULL) { + if (wpt == nullptr) { fatal(MYNAME ": Error in file structure.\n"); } - if (gmsd == NULL) { + if (gmsd == nullptr) { gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } @@ -273,7 +273,7 @@ static char* gpi_read_string_old(const char* field) { int l0; - char* res = NULL; + char* res = nullptr; l0 = gbfgetint16(fin); if (l0 > 0) { @@ -283,8 +283,8 @@ gpi_read_string_old(const char* field) if (first == 0) { short l1; short l2; - char* res1 = NULL; - char* res2 = NULL; + char* res1 = nullptr; + char* res2 = nullptr; char lc1[3] = ""; char lc2[3] = ""; @@ -497,7 +497,7 @@ read_poi_list(const int sz) while (gbftell(fin) < (gbsize_t)(pos + sz - 4)) { int tag = gbfgetint32(fin); - if (! read_tag("read_poi_list", tag, NULL)) { + if (! read_tag("read_poi_list", tag, nullptr)) { return; } } @@ -533,7 +533,7 @@ read_poi_group(const int sz, const int tag) while (gbftell(fin) < (gbsize_t)(pos + sz)) { int subtag = gbfgetint32(fin); - if (! read_tag("read_poi_group", subtag, NULL)) { + if (! read_tag("read_poi_group", subtag, nullptr)) { break; } } @@ -891,7 +891,7 @@ wdata_check(writer_data_t* data) } } - if (*ref == NULL) { + if (*ref == nullptr) { *ref = wdata_alloc(); } @@ -1320,7 +1320,7 @@ load_bitmap_from_file(const char* fname, unsigned char** data, int* data_sz) int dest_bpp; int src_line_sz, dest_line_sz; bmp_header_t src_h; - int* color_table = NULL; + int* color_table = nullptr; gpi_bitmap_header_t* dest_h; unsigned char* ptr; @@ -1502,7 +1502,7 @@ garmin_gpi_wr_init(const QString& fname) int i; if (gpi_timestamp != 0) { /* not the first gpi output session */ - time_t t = time(NULL); + time_t t = time(nullptr); if (t <= gpi_timestamp) { gpi_timestamp++; /* don't create files with same timestamp */ } else { @@ -1598,7 +1598,7 @@ garmin_gpi_wr_deinit() sleep = 1; } gpi_timestamp += sleep; - while (gpi_timestamp > time(NULL)) { + while (gpi_timestamp > time(nullptr)) { gb_sleep(100); } } @@ -1613,7 +1613,7 @@ garmin_gpi_read() if (tag == 0xffff) { return; } - if (! read_tag("garmin_gpi_read", tag, NULL)) { + if (! read_tag("garmin_gpi_read", tag, nullptr)) { return; } }; @@ -1631,7 +1631,7 @@ garmin_gpi_write() } if (opt_hide_bitmap) { - image = NULL; + image = nullptr; image_sz = 0; } else if (opt_bitmap && *opt_bitmap) { load_bitmap_from_file(opt_bitmap, &image, &image_sz); @@ -1668,7 +1668,7 @@ ff_vecs_t garmin_gpi_vecs = { garmin_gpi_wr_deinit, garmin_gpi_read, garmin_gpi_write, - NULL, + nullptr, garmin_gpi_args, CET_CHARSET_MS_ANSI, 0 /* WIN-CP1252 */ , NULL_POS_OPS, diff --git a/garmin_tables.cc b/garmin_tables.cc index 78c30504b..f6f324dd9 100644 --- a/garmin_tables.cc +++ b/garmin_tables.cc @@ -337,7 +337,7 @@ icon_mapping_t garmin_icon_table[] = { { 248, -1, "Water Source" }, - { -1, -1, NULL }, + { -1, -1, nullptr }, }; icon_mapping_t garmin_smart_icon_table[] = { @@ -350,7 +350,7 @@ icon_mapping_t garmin_smart_icon_table[] = { { 83, 8214, "Post Office" }, /* Icon for "Post Office" */ { 47, 160, "Event Cache" }, /* Icon for "Event" */ { 90, 8221, "Webcam Cache" }, /* Icon for "Live Theatre" */ - { -1, -1, NULL } + { -1, -1, nullptr } }; /* ICAO country code table */ @@ -581,7 +581,7 @@ gt_country_code_t gt_country_codes[] = { { "AY,", "Papua New Guinea" }, { "AN,", "Nauru" }, { "AG,", "Solomon Islands" }, - { NULL, NULL } + { nullptr, nullptr } }; /* gt_waypt_classes: gdb internal order */ @@ -599,7 +599,7 @@ const char* gt_waypt_class_names[] = { "Map Intersection", "Map Address", "Map Line", - NULL + nullptr }; /* gt_display_mode_names: this order is used by most devices */ @@ -624,7 +624,7 @@ grid_mapping_t gt_mps_grid_names[] = { { "bng", "British National Grid", grid_bng }, { "utm", "UTM", grid_utm }, { "swiss", "Swiss grid", grid_swiss }, - { NULL, NULL, (grid_type) 0 } + { nullptr, nullptr, (grid_type) 0 } }; /* gt_mps_datum_names: */ @@ -648,7 +648,7 @@ static datum_mapping_t gt_mps_datum_names[] = { { "Mexico NAD27", "NAD27 Mexico" }, { "North America 83", "NAD83" }, { "OSGB36", "Ord Srvy Grt Britn" }, - { NULL, NULL } + { nullptr, nullptr } }; typedef struct garmin_color_s { @@ -675,7 +675,7 @@ static garmin_color_t gt_colors[] = { { "Cyan", 0xFFFF00 }, { "White", 0xFFFFFF }, { "Transparent", unknown_color }, /* Currently not handled */ - { NULL, 0 } + { nullptr, 0 } }; #define GT_COLORS_CT ((sizeof(gt_colors) / sizeof(gt_colors[0])) - 1) @@ -841,10 +841,10 @@ int gt_find_icon_number_from_desc(const QString& desc, garmin_formats_e garmin_f if (find_flag == 0) { const char** prefix; const char* prefixes[] = { - "White ", "Red ", "Green ", "Blue ", "Black ", NULL + "White ", "Red ", "Green ", "Blue ", "Black ", nullptr }; // Rewrite "Green Square" to "Square, Green". - for (prefix = prefixes; *prefix != NULL; prefix++) { + for (prefix = prefixes; *prefix != nullptr; prefix++) { if (desc.startsWith(*prefix, Qt::CaseInsensitive)) { QString buff = desc; buff.replace(*prefix, ""); @@ -869,13 +869,13 @@ gt_get_icao_country(const QString& cc) gt_country_code_t* x = >_country_codes[0]; if (cc.isEmpty()) { - return NULL; + return nullptr; } do { const char* ccx = x->cc; const QString qccx = x->cc; - while (ccx != NULL) { + while (ccx != nullptr) { if (qccx.left(2) == cc) { return x->country; } @@ -883,14 +883,14 @@ gt_get_icao_country(const QString& cc) return x->country; } ccx = strchr(ccx, ','); - if (ccx == NULL) { + if (ccx == nullptr) { break; } ccx++; } x++; - } while (x->cc != NULL); - return NULL; + } while (x->cc != nullptr); + return nullptr; } const char* @@ -901,8 +901,8 @@ gt_get_icao_cc(const QString& country, const QString& shortname) if (country.isEmpty()) { const char* test; - if (shortname == NULL) { - return NULL; + if (shortname == nullptr) { + return nullptr; } switch (shortname.length()) { case 3: @@ -912,13 +912,13 @@ gt_get_icao_cc(const QString& country, const QString& shortname) strncpy(res, CSTR(shortname), 2); break; default: - return NULL; + return nullptr; } test = gt_get_icao_country(res); - if (test != NULL) { + if (test != nullptr) { return res; } else { - return NULL; + return nullptr; } } @@ -942,7 +942,7 @@ gt_get_icao_cc(const QString& country, const QString& shortname) strncpy(res, CSTR(shortname), 2); res[2] = '\0'; - while (ccx != NULL) { + while (ccx != nullptr) { if (strncmp(ccx, res, 2) == 0) { return res; } @@ -950,15 +950,15 @@ gt_get_icao_cc(const QString& country, const QString& shortname) return res; } ccx = strchr(ccx, ','); - if (ccx == NULL) { + if (ccx == nullptr) { break; } ccx++; } } - return NULL; - } while (x->country != NULL); - return NULL; + return nullptr; + } while (x->country != nullptr); + return nullptr; } grid_type diff --git a/garmin_txt.cc b/garmin_txt.cc index e5781fc3b..6abe3b566 100644 --- a/garmin_txt.cc +++ b/garmin_txt.cc @@ -56,7 +56,7 @@ static grid_type grid_index; static int datum_index; static const char* datum_str; static int current_line; -static char* date_time_format = NULL; +static char* date_time_format = nullptr; static int precision = 3; static time_t utc_offs = 0; // Having a Windows background, this software encodes degree marks in @@ -103,25 +103,25 @@ static int header_ct[unknown_header + 1]; #define IS_VALID_ALT(a) (((a) != unknown_alt) && ((a) < GARMIN_UNKNOWN_ALT)) #define DUPSTR(a) (((a) != NULL) && ((a)[0] != 0)) ? ((a)) : NULL -static char* opt_datum = NULL; -static char* opt_dist = NULL; -static char* opt_temp = NULL; -static char* opt_date_format = NULL; -static char* opt_time_format = NULL; -static char* opt_precision = NULL; -static char* opt_utc = NULL; -static char* opt_grid = NULL; +static char* opt_datum = nullptr; +static char* opt_dist = nullptr; +static char* opt_temp = nullptr; +static char* opt_date_format = nullptr; +static char* opt_time_format = nullptr; +static char* opt_precision = nullptr; +static char* opt_utc = nullptr; +static char* opt_grid = nullptr; static arglist_t garmin_txt_args[] = { - {"date", &opt_date_format, "Read/Write date format (i.e. yyyy/mm/dd)", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, + {"date", &opt_date_format, "Read/Write date format (i.e. yyyy/mm/dd)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, {"datum", &opt_datum, "GPS datum (def. WGS 84)", "WGS 84", ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, {"dist", &opt_dist, "Distance unit [m=metric, s=statute]", "m", ARGTYPE_STRING, ARG_NOMINMAX}, - {"grid", &opt_grid, "Write position using this grid.", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, + {"grid", &opt_grid, "Write position using this grid.", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, {"prec", &opt_precision, "Precision of coordinates", "3", ARGTYPE_INT, ARG_NOMINMAX, nullptr}, {"temp", &opt_temp, "Temperature unit [c=Celsius, f=Fahrenheit]", "c", ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, - {"time", &opt_time_format, "Read/Write time format (i.e. HH:mm:ss xx)", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, - {"utc", &opt_utc, "Write timestamps with offset x to UTC time", NULL, ARGTYPE_INT, "-23", "+23", nullptr}, + {"time", &opt_time_format, "Read/Write time format (i.e. HH:mm:ss xx)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, + {"utc", &opt_utc, "Write timestamps with offset x to UTC time", nullptr, ARGTYPE_INT, "-23", "+23", nullptr}, ARG_TERMINATOR }; @@ -149,7 +149,7 @@ static const char* headers[] = { "Position\tTime\tAltitude\tDepth\tTemperature\tLeg Length\tLeg Time\tLeg Speed\tLeg Course", "Name\tLength\tCourse\tWaypoints\tLink", "Name\tStart Time\tElapsed Time\tLength\tAverage Speed\tLink", - NULL + nullptr }; /* helpers */ @@ -157,7 +157,7 @@ static const char* headers[] = { static const char* get_option_val(const char* option, const char* def) { - const char* c = (option != NULL) ? option : def; + const char* c = (option != nullptr) ? option : def; return c; } @@ -238,7 +238,7 @@ static void prework_hdr_cb(const route_head*) { cur_info = &route_info[route_idx]; - cur_info->prev_wpt = NULL; + cur_info->prev_wpt = nullptr; cur_info->length = 0; cur_info->time = 0; } @@ -255,7 +255,7 @@ prework_wpt_cb(const Waypoint* wpt) { Waypoint* prev = cur_info->prev_wpt; - if (prev != NULL) { + if (prev != nullptr) { cur_info->time += (wpt->GetCreationTime().toTime_t() - prev->GetCreationTime().toTime_t()); cur_info->length += waypt_distance_ex(prev, wpt); } else { @@ -353,7 +353,7 @@ print_position(const Waypoint* wpt) gbfprintf(fout, "#####\n"); fatal(MYNAME ": %s (%s) is outside of convertable area \"%s\"!\n", wpt->shortname.isEmpty() ? "Waypoint" : qPrintable(wpt->shortname), - pretty_deg_format(wpt->latitude, wpt->longitude, 'd', NULL, 0), + pretty_deg_format(wpt->latitude, wpt->longitude, 'd', nullptr, 0), gt_get_mps_grid_longname(grid_index, MYNAME)); } } @@ -398,16 +398,16 @@ print_categories(uint16_t categories) count = 0; for (i = 0; i < 16; i++) { if ((categories & 1) != 0) { - if (global_opts.inifile != NULL) { + if (global_opts.inifile != nullptr) { char key[3]; snprintf(key, sizeof(key), "%d", i + 1); c = inifile_readstr(global_opts.inifile, GMSD_SECTION_CATEGORIES, key); } else { - c = NULL; + c = nullptr; } gbfprintf(fout, "%s", (count++ > 0) ? "," : ""); - if (c == NULL) { + if (c == nullptr) { gbfprintf(fout, "Category %d", i+1); } // gbfprintf(fout, "%s", gps_categories[i]); @@ -423,7 +423,7 @@ print_categories(uint16_t categories) static void print_course(const Waypoint* A, const Waypoint* B) /* seems to be okay */ { - if ((A != NULL) && (B != NULL) && (A != B)) { + if ((A != nullptr) && (B != nullptr) && (A != B)) { int course; course = si_round(waypt_course(A, B)); gbfprintf(fout, "%d%c true", course, kDegreeSymbol); @@ -612,7 +612,7 @@ write_waypt(const Waypoint* wpt) print_string("%s\t", GMSD_GET(city, "")); print_string("%s\t", GMSD_GET(state, "")); country = gt_get_icao_country(GMSD_GET(cc, "")); - print_string("%s\t", (country != NULL) ? country : ""); + print_string("%s\t", (country != nullptr) ? country : ""); print_date_and_time(wpt->GetCreationTime().toTime_t(), 0); if (wpt->HasUrlLink()) { UrlLink l = wpt->GetUrlLink(); @@ -630,7 +630,7 @@ route_disp_hdr_cb(const route_head* rte) { current_trk = (route_head*)rte; cur_info = &route_info[route_idx]; - cur_info->prev_wpt = NULL; + cur_info->prev_wpt = nullptr; cur_info->total = 0; if (rte->rte_waypt_ct <= 0) { return; @@ -662,7 +662,7 @@ route_disp_wpt_cb(const Waypoint* wpt) gbfprintf(fout, "Route Waypoint\t"); gbfprintf(fout, "%s\t", CSTRc(wpt->shortname)); - if (prev != NULL) { + if (prev != nullptr) { double dist = waypt_distance_ex(prev, wpt); cur_info->total += dist; print_distance(cur_info->total, 0, 1, 0); @@ -681,7 +681,7 @@ static void track_disp_hdr_cb(const route_head* track) { cur_info = &route_info[route_idx]; - cur_info->prev_wpt = NULL; + cur_info->prev_wpt = nullptr; cur_info->total = 0; current_trk = (route_head*)track; if (track->rte_waypt_ct <= 0) { @@ -728,7 +728,7 @@ track_disp_wpt_cb(const Waypoint* wpt) print_distance(depth, 1, 0, 1); } - if (prev != NULL) { + if (prev != nullptr) { float temp; gbfprintf(fout, "\t"); delta = wpt->GetCreationTime().toTime_t() - prev->GetCreationTime().toTime_t(); @@ -769,11 +769,11 @@ garmin_txt_wr_init(const QString& fname) is_fatal(precision < 0, MYNAME ": Invalid precision (%s)!", opt_precision); } - datum_str = get_option_val(opt_datum, NULL); - grid_str = get_option_val(opt_grid, NULL); + datum_str = get_option_val(opt_datum, nullptr); + grid_str = get_option_val(opt_grid, nullptr); grid_index = grid_lat_lon_dmm; - if (grid_str != NULL) { + if (grid_str != nullptr) { int i; if (sscanf(grid_str, "%d", &i)) { @@ -797,7 +797,7 @@ garmin_txt_wr_init(const QString& fname) datum_index = gt_lookup_datum_index(datum_str, MYNAME); } - if (opt_utc != NULL) { + if (opt_utc != nullptr) { if (case_ignore_strcmp(opt_utc, "utc") == 0) { utc_offs = 0; } else { @@ -834,7 +834,7 @@ garmin_txt_write() waypoints = 0; gtxt_flags.enum_waypoints = 1; /* enum all waypoints */ waypt_disp_all(enum_waypt_cb); - route_disp_all(NULL, NULL, enum_waypt_cb); + route_disp_all(nullptr, nullptr, enum_waypt_cb); gtxt_flags.enum_waypoints = 0; if (waypoints > 0) { @@ -843,7 +843,7 @@ garmin_txt_write() wpt_a_ct = 0; wpt_a = (Waypoint**)xcalloc(waypoints, sizeof(*wpt_a)); waypt_disp_all(enum_waypt_cb); - route_disp_all(NULL, NULL, enum_waypt_cb); + route_disp_all(nullptr, nullptr, enum_waypt_cb); qsort(wpt_a, waypoints, sizeof(*wpt_a), sort_waypt_cb); gbfprintf(fout, "Header\t%s\r\n\r\n", headers[waypt_header]); @@ -887,9 +887,9 @@ free_header(const header_type ht) for (i = 0; i < MAX_HEADER_FIELDS; i++) { char* c = header_lines[ht][i]; - if (c != NULL) { + if (c != nullptr) { xfree(c); - header_lines[ht][i] = NULL; + header_lines[ht][i] = nullptr; } } header_ct[ht] = 0; @@ -911,9 +911,9 @@ parse_date_and_time(char* str, time_t* value) } cerr = strptime(cin, date_time_format, &tm); - if (cerr == NULL) { + if (cerr == nullptr) { cerr = strptime(cin, "%m/%d/%Y %I:%M:%S %p", &tm); - is_fatal(cerr == NULL, MYNAME ": Invalid date or/and time \"%s\" at line %d!", cin, current_line); + is_fatal(cerr == nullptr, MYNAME ": Invalid date or/and time \"%s\" at line %d!", cin, current_line); } // printf(MYNAME "_parse_date_and_time: %02d.%02d.%04d, %02d:%02d:%02d\n", @@ -964,7 +964,7 @@ parse_temperature(const char* str, double* temperature) double value; unsigned char unit; - if ((str == NULL) || (*str == '\0')) { + if ((str == nullptr) || (*str == '\0')) { return 0; } @@ -995,7 +995,7 @@ parse_header() free_header(unknown_header); - while ((str = csv_lineparse(NULL, "\t", "", column++))) { + while ((str = csv_lineparse(nullptr, "\t", "", column++))) { header_lines[unknown_header][column] = strupper(xstrdup(str)); header_ct[unknown_header]++; if (header_ct[unknown_header] >= MAX_HEADER_FIELDS) { @@ -1009,7 +1009,7 @@ parse_display(const char* str, int* val) { gt_display_modes_e i; - if ((str == NULL) || (*str == '\0')) { + if ((str == nullptr) || (*str == '\0')) { return 0; } @@ -1051,7 +1051,7 @@ bind_fields(const header_type ht) char* name; int field_no; name = header_lines[ht][i] = header_lines[unknown_header][i]; - header_lines[unknown_header][i] = NULL; + header_lines[unknown_header][i] = nullptr; c = fields; field_no = 1; @@ -1074,14 +1074,14 @@ bind_fields(const header_type ht) static void parse_grid() { - char* str = csv_lineparse(NULL, "\t", "", 1); + char* str = csv_lineparse(nullptr, "\t", "", 1); - if (str != NULL) { - if (strstr(str, "dd.ddddd") != 0) { + if (str != nullptr) { + if (strstr(str, "dd.ddddd") != nullptr) { grid_index = grid_lat_lon_ddd; - } else if (strstr(str, "mm.mmm") != 0) { + } else if (strstr(str, "mm.mmm") != nullptr) { grid_index = grid_lat_lon_dmm; - } else if (strstr(str, "mm'ss.s") != 0) { + } else if (strstr(str, "mm'ss.s") != nullptr) { grid_index = grid_lat_lon_dms; } else { grid_index = gt_lookup_grid_type(str, MYNAME); @@ -1094,9 +1094,9 @@ parse_grid() static void parse_datum() { - char* str = csv_lineparse(NULL, "\t", "", 1); + char* str = csv_lineparse(nullptr, "\t", "", 1); - if (str != NULL) { + if (str != nullptr) { datum_index = gt_lookup_datum_index(str, MYNAME); } else { fatal(MYNAME ": Missing GPS datum headline!\n"); @@ -1109,7 +1109,7 @@ parse_waypoint() char* str; int column = -1; Waypoint* wpt; - garmin_fs_p gmsd = NULL; + garmin_fs_p gmsd = nullptr; bind_fields(waypt_header); @@ -1117,7 +1117,7 @@ parse_waypoint() gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); - while ((str = csv_lineparse(NULL, "\t", "", column++))) { + while ((str = csv_lineparse(nullptr, "\t", "", column++))) { int i; double d; int field_no = header_fields[waypt_header][column]; @@ -1217,7 +1217,7 @@ parse_route_header() rte = route_head_alloc(); bind_fields(route_header); - while ((str = csv_lineparse(NULL, "\t", "", column++))) { + while ((str = csv_lineparse(nullptr, "\t", "", column++))) { int field_no = header_fields[route_header][column]; switch (field_no) { case 1: @@ -1241,7 +1241,7 @@ parse_track_header() bind_fields(track_header); trk = route_head_alloc(); - while ((str = csv_lineparse(NULL, "\t", "", column++))) { + while ((str = csv_lineparse(nullptr, "\t", "", column++))) { int field_no = header_fields[track_header][column]; switch (field_no) { case 1: @@ -1261,22 +1261,22 @@ parse_route_waypoint() { char* str; int column = -1; - Waypoint* wpt = NULL; + Waypoint* wpt = nullptr; bind_fields(rtept_header); - while ((str = csv_lineparse(NULL, "\t", "", column++))) { + while ((str = csv_lineparse(nullptr, "\t", "", column++))) { int field_no = header_fields[rtept_header][column]; switch (field_no) { case 1: is_fatal((*str == '\0'), MYNAME ": Route waypoint without name at line %d!\n", current_line); wpt = find_waypt_by_name(str); - is_fatal((wpt == NULL), MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", str, current_line); + is_fatal((wpt == nullptr), MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", str, current_line); wpt = new Waypoint(*wpt); break; } } - if (wpt != NULL) { + if (wpt != nullptr) { route_add_wpt(current_rte, wpt); } } @@ -1291,7 +1291,7 @@ parse_track_waypoint() bind_fields(trkpt_header); wpt = new Waypoint; - while ((str = csv_lineparse(NULL, "\t", "", column++))) { + while ((str = csv_lineparse(nullptr, "\t", "", column++))) { int field_no; double x; @@ -1389,7 +1389,7 @@ garmin_txt_read() cin = csv_lineparse(cin, "\t", "", 0); - if (cin == NULL) { + if (cin == nullptr) { continue; } @@ -1415,7 +1415,7 @@ garmin_txt_read() } /* flush pending data */ - while (csv_lineparse(NULL, "\t", "", 0)); + while (csv_lineparse(nullptr, "\t", "", 0)); } } @@ -1428,7 +1428,7 @@ ff_vecs_t garmin_txt_vecs = { garmin_txt_wr_deinit, garmin_txt_read, garmin_txt_write, - NULL, + nullptr, garmin_txt_args, CET_CHARSET_MS_ANSI, 0 , NULL_POS_OPS, diff --git a/garmin_xt.cc b/garmin_xt.cc index 1d8e4c876..9e5e2713b 100644 --- a/garmin_xt.cc +++ b/garmin_xt.cc @@ -52,8 +52,8 @@ static int colors[] = { static gbfile* fin; static route_head* track; -static char* opt_xt_ftype = NULL; -static char* opt_trk_header = NULL; +static char* opt_xt_ftype = nullptr; +static char* opt_trk_header = nullptr; static arglist_t format_garmin_xt_args[] = { @@ -424,12 +424,12 @@ ff_vecs_t format_garmin_xt_vecs = { ff_cap_none /* routes */ }, format_garmin_xt_rd_init, - NULL, + nullptr, format_garmin_xt_rd_deinit, - NULL, + nullptr, format_garmin_xt_read, - NULL, - NULL, + nullptr, + nullptr, format_garmin_xt_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ diff --git a/gbfile.cc b/gbfile.cc index a895ac7e3..4cad0fbc5 100644 --- a/gbfile.cc +++ b/gbfile.cc @@ -70,7 +70,7 @@ gzapi_open(gbfile* self, const char* mode) /* under non-posix systems files MUST be opened in binary mode */ strcpy(openmode, mode); - if (strchr(mode, 'b') == NULL) { + if (strchr(mode, 'b') == nullptr) { strncat(openmode, "b", sizeof(openmode) - strlen(openmode) - 1); } @@ -94,7 +94,7 @@ gzapi_open(gbfile* self, const char* mode) #endif } - if (self->handle.gz == NULL) { + if (self->handle.gz == nullptr) { fatal("%s: Cannot %s file '%s'!\n", self->module, (self->mode == 'r') ? "open" : "create", @@ -367,7 +367,7 @@ memapi_open(gbfile* self, const char* mode) self->mempos = 0; self->memsz = 0; - self->handle.mem = NULL; + self->handle.mem = nullptr; return self; } @@ -511,9 +511,9 @@ gbfopen(const QString filename, const char* mode, const char* module) file->module = xstrdup(module); file->mode = 'r'; // default - file->binary = (strchr(mode, 'b') != NULL); + file->binary = (strchr(mode, 'b') != nullptr); file->back = -1; - file->memapi = (filename == NULL); + file->memapi = (filename == nullptr); for (m = mode; *m; m++) { switch (tolower(*m)) { @@ -1054,11 +1054,11 @@ gbfgetucs2str(gbfile* file) c0 = gbfgetc(file); if ((c0 == EOF) && (len == 0)) { - return NULL; + return nullptr; } c1 = gbfgetc(file); if ((c1 == EOF) && (len == 0)) { - return NULL; + return nullptr; } if (file->big_endian) { @@ -1071,11 +1071,11 @@ gbfgetucs2str(gbfile* file) c0 = gbfgetc(file); if ((c0 == EOF) && (len == 0)) { - return NULL; + return nullptr; } c1 = gbfgetc(file); if ((c1 == EOF) && (len == 0)) { - return NULL; + return nullptr; } if (file->big_endian) { @@ -1094,7 +1094,7 @@ gbfgetucs2str(gbfile* file) clen = cet_ucs4_to_utf8(buff, sizeof(buff), c0); if (clen < 1) { Warning() << "Malformed UCS character" << c0 << "found."; - return NULL; + return nullptr; } if (len+clen >= file->buffsz) { @@ -1129,7 +1129,7 @@ gbfgetstr(gbfile* file) if ((c == EOF) || (c == 0x1A)) { if (len == 0) { - return NULL; + return nullptr; } break; } else if (c == '\r') { diff --git a/gbser.cc b/gbser.cc index 27749ec56..77388a269 100644 --- a/gbser.cc +++ b/gbser.cc @@ -110,7 +110,7 @@ int gbser_setup(void* handle, const char* spec) */ int gbser_avail(void* handle) { - return gbser__fill_buffer(handle, 1, NULL); + return gbser__fill_buffer(handle, 1, nullptr); } /* Read as many bytes as are available without blocking. At most |len| @@ -122,7 +122,7 @@ int gbser_read(void* handle, void* buf, unsigned len) int got = 0; while (len > 0) { - int rc = gbser__fill_buffer(handle, len, NULL); + int rc = gbser__fill_buffer(handle, len, nullptr); if (rc < 0) { /* error */ return rc; diff --git a/gbser_posix.cc b/gbser_posix.cc index 7ad669c3d..7ddc6f163 100644 --- a/gbser_posix.cc +++ b/gbser_posix.cc @@ -88,7 +88,7 @@ typedef struct timeval hp_time; static void get_time(hp_time* tv) { - gettimeofday(tv, NULL); + gettimeofday(tv, nullptr); } static double elapsed(hp_time* tv) @@ -97,7 +97,7 @@ static double elapsed(hp_time* tv) double ot = (double) tv->tv_sec * 1000 + (double) tv->tv_usec / 1000; double nt; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); nt = (double) now.tv_sec * 1000 + (double) now.tv_usec / 1000; /*printf("elapsed -> %f\n", nt - ot);*/ @@ -166,7 +166,7 @@ failed: xfree(h); - return NULL; + return nullptr; } /* Close a serial port @@ -290,7 +290,7 @@ int gbser__fill_buffer(void* handle, unsigned want, unsigned* ms) return h->inbuf_used; } - if (NULL == ms || 0 == *ms) { + if (nullptr == ms || 0 == *ms) { if ((rc = set_rx_timeout(h, 0, 0), rc < 0) || (rc = read(h->fd, h->inbuf + h->inbuf_used, want - h->inbuf_used), rc < 0)) { @@ -318,7 +318,7 @@ int gbser__fill_buffer(void* handle, unsigned want, unsigned* ms) t.tv_sec = (time_t) time_left / 1000; t.tv_usec = ((unsigned) time_left % 1000) * 1000; - if (select(h->fd + 1, &rec, NULL, NULL, &t) < 0) { + if (select(h->fd + 1, &rec, nullptr, nullptr, &t) < 0) { return gbser_ERROR; } diff --git a/gbsleep.cc b/gbsleep.cc index 7a97a915f..cc72a142d 100644 --- a/gbsleep.cc +++ b/gbsleep.cc @@ -40,7 +40,7 @@ gb_sleep(unsigned long microseconds) struct timespec req; req.tv_sec = microseconds / 1000000; req.tv_nsec = (microseconds * 1000) % 1000000000; - nanosleep(&req, NULL); + nanosleep(&req, nullptr); } #elif defined HAVE_SLEEP /* Amazingly underachieving, but probably "good enough" */ diff --git a/gdb.cc b/gdb.cc index e322d7756..348b56806 100644 --- a/gdb.cc +++ b/gdb.cc @@ -237,7 +237,7 @@ gdb_fread_cstr(gbfile* fin) if (result && (*result == '\0')) { xfree(result); - result = NULL; + result = nullptr; } return result; @@ -302,7 +302,7 @@ gdb_find_wayptq(const queue* Q, const Waypoint* wpt, const char exact) } } } - return NULL; + return nullptr; } static Waypoint* @@ -310,7 +310,7 @@ gdb_reader_find_waypt(const Waypoint* wpt, const char exact) { Waypoint* res; res = gdb_find_wayptq(&wayptq_in, wpt, exact); - if (res == NULL) { + if (res == nullptr) { res = gdb_find_wayptq(&wayptq_in_hidden, wpt, exact); } return res; @@ -323,11 +323,11 @@ gdb_add_route_waypt(route_head* rte, Waypoint* ref, const int wpt_class) int turn_point; tmp = gdb_reader_find_waypt(ref, 1); - if (tmp == NULL) { + if (tmp == nullptr) { double dist; tmp = find_waypt_by_name(ref->shortname); - if (tmp == NULL) { + if (tmp == nullptr) { route_add_wpt(rte, ref); return ref; } @@ -348,7 +348,7 @@ gdb_add_route_waypt(route_head* rte, Waypoint* ref, const int wpt_class) } } - res = NULL; + res = nullptr; turn_point = (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && !tmp->description.isEmpty()); if (turn_point || (gdb_via == 0) || (wpt_class < gt_waypt_class_map_point)) { res = new Waypoint(*tmp); @@ -463,9 +463,9 @@ read_file_header() Q_UNUSED(i); if (global_opts.verbose_status > 0) { const char* name = buf+2; - if (strstr(name, "SQA") == 0) { + if (strstr(name, "SQA") == nullptr) { name = "MapSource"; - } else if (strstr(name, "neaderhi") == 0) { + } else if (strstr(name, "neaderhi") == nullptr) { name = "MapSource BETA"; } warning(MYNAME ": File created with \"%s\"\n", name); @@ -640,7 +640,7 @@ read_waypoint(gt_waypt_classes_e* waypt_class_out) for (i = url_ct; (i); i--) { QString str = FREAD_CSTR_AS_QSTR; if (!str.isEmpty()) { - waypt_add_url(res, str, NULL); + waypt_add_url(res, str, nullptr); #if GDB_DEBUG DBG(GDB_DBG_WPTe, 1) printf(MYNAME "-wpt \"%s\" (%d): url(%d) = %s\n", @@ -809,8 +809,8 @@ read_route() } links = FREAD_i32; - il_anchor = NULL; - il_root = NULL; + il_anchor = nullptr; + il_root = nullptr; #if GDB_DEBUG DBG(GDB_DBG_RTE, links) printf(MYNAME "-rte_pt \"%s\" (%d): %d interlink step(s)\n", @@ -835,8 +835,8 @@ read_route() wpt->altitude = il_step->alt; } - il_step->next = NULL; - if (il_anchor == NULL) { + il_step->next = nullptr; + if (il_anchor == nullptr) { il_root = il_step; } else { il_anchor->next = il_step; @@ -871,7 +871,7 @@ read_route() if (links == 0) { /* Without links we need all informations from wpt */ Waypoint* tmp = gdb_reader_find_waypt(wpt, 0); - if (tmp != NULL) { + if (tmp != nullptr) { delete wpt; wpt = new Waypoint(*tmp); } else { @@ -899,15 +899,15 @@ read_route() wpt->longitude < 0 ? 'W' : 'E', wpt->longitude); #endif wpt = gdb_add_route_waypt(rte, wpt, wpt_class); - if (wpt != NULL) { + if (wpt != nullptr) { garmin_fs_t* gmsd = GMSD_FIND(wpt); - if (gmsd == NULL) { + if (gmsd == nullptr) { gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); } GMSD_SET(wpt_class, wpt_class); gmsd->ilinks = il_root; - il_root = NULL; + il_root = nullptr; } while (il_root) { @@ -1010,7 +1010,7 @@ static void gdb_rd_init(const QString& fname) { fin = gbfopen_le(fname, "rb", MYNAME); - ftmp = gbfopen_le(NULL, "wb", MYNAME); + ftmp = gbfopen_le(nullptr, "wb", MYNAME); read_file_header(); /* VERSION DEPENDENT CODE */ if (gdb_ver >= GDB_VER_UTF8) { @@ -1066,7 +1066,7 @@ read_data() } gbfrewind(ftmp); - gbfwrite(NULL, 0, 0, ftmp); /* truncate */ + gbfwrite(nullptr, 0, 0, ftmp); /* truncate */ gbfcopyfrom(ftmp, fin, len); gbfrewind(ftmp); @@ -1159,7 +1159,7 @@ read_data() static void reset_short_handle(const char* defname) { - if (short_h != NULL) { + if (short_h != nullptr) { mkshort_del_handle(&short_h); } @@ -1349,7 +1349,7 @@ write_waypoint( } descr = (wpt_class < gt_waypt_class_map_point) ? ld : wpt->description; - if ((descr != NULL) && (wpt_class >= gt_waypt_class_map_point) && \ + if ((descr != nullptr) && (wpt_class >= gt_waypt_class_map_point) && \ descr == CSTRc(wpt->shortname)) { descr.clear(); } @@ -1472,7 +1472,7 @@ write_route(const route_head* rte, const QString& rte_name) Waypoint* wpt = (Waypoint*)elem; Waypoint* next = (Waypoint*)tmp; Waypoint* test; - garmin_fs_t* gmsd = NULL; + garmin_fs_t* gmsd = nullptr; int wpt_class; index++; @@ -1486,7 +1486,7 @@ write_route(const route_head* rte, const QString& rte_name) } test = gdb_find_wayptq(&wayptq_out, wpt, 1); - if (test != NULL) { + if (test != nullptr) { wpt = test; } else { fatal(MYNAME ": Sorry, that should never happen!!!\n"); @@ -1614,7 +1614,7 @@ finalize_item(gbfile* origin, const char identifier) gbfcopyfrom(fout, ftmp, len); gbfseek(ftmp, 0, SEEK_SET); /* Truncate memory stream */ - gbfwrite(NULL, 0, 0, ftmp); + gbfwrite(nullptr, 0, 0, ftmp); } /*-----------------------------------------------------------------------------*/ @@ -1639,17 +1639,17 @@ write_waypoint_cb(const Waypoint* refpt) UrlLink orig_link = refpt->GetUrlLink(); UrlLink test_link = test->GetUrlLink(); if (orig_link.url_ != test_link.url_) { - test = NULL; + test = nullptr; } } - if ((test != NULL) && (route_flag == 0)) { + if ((test != nullptr) && (route_flag == 0)) { if (test->notes != refpt->notes) { - test = NULL; + test = nullptr; } } - if (test == NULL) { + if (test == nullptr) { int icon, display, wpt_class; Waypoint* wpt = new Waypoint(*refpt); @@ -1779,7 +1779,7 @@ static void gdb_wr_init(const QString& fname) { fout = gbfopen_le(fname, "wb", MYNAME); - ftmp = gbfopen_le(NULL, "wb", MYNAME); + ftmp = gbfopen_le(nullptr, "wb", MYNAME); gdb_category = (gdb_opt_category) ? atoi(gdb_opt_category) : 0; gdb_ver = (gdb_opt_ver && *gdb_opt_ver) ? atoi(gdb_opt_ver) : 0; @@ -1791,7 +1791,7 @@ gdb_wr_init(const QString& fname) } if (gdb_opt_bitcategory) { - gdb_category = strtol(gdb_opt_bitcategory, NULL, 0); + gdb_category = strtol(gdb_opt_bitcategory, nullptr, 0); } if (gdb_ver >= GDB_VER_UTF8) { @@ -1799,7 +1799,7 @@ gdb_wr_init(const QString& fname) } QUEUE_INIT(&wayptq_out); - short_h = NULL; + short_h = nullptr; waypt_ct = 0; waypth_ct = 0; @@ -1831,13 +1831,13 @@ write_data() route_flag = 0; waypt_disp_all(write_waypoint_cb); route_flag = 1; - route_disp_all(NULL, NULL, write_waypoint_cb); + route_disp_all(nullptr, nullptr, write_waypoint_cb); reset_short_handle("Route"); - route_disp_all(write_route_cb, NULL, NULL); + route_disp_all(write_route_cb, nullptr, nullptr); reset_short_handle("Track"); - track_disp_all(write_track_cb, NULL, NULL); + track_disp_all(write_track_cb, nullptr, nullptr); FWRITE_i32(2); /* finalize gdb with empty map segment */ FWRITE_CSTR("V"); @@ -1856,11 +1856,11 @@ static arglist_t gdb_args[] = { { GDB_OPT_CATEGORY, &gdb_opt_category, "Default category on output (1..16)", - NULL, ARGTYPE_INT, "1", "16" + nullptr, ARGTYPE_INT, "1", "16" }, { GDB_OPT_BITCATEGORY, &gdb_opt_bitcategory, "Bitmap of categories", - NULL, ARGTYPE_INT, "1", "65535" + nullptr, ARGTYPE_INT, "1", "65535" }, { GDB_OPT_VER, &gdb_opt_ver, @@ -1870,12 +1870,12 @@ static arglist_t gdb_args[] = { { GDB_OPT_VIA, &gdb_opt_via, "Drop route points that do not have an equivalent waypoint (hidden points)", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, { GDB_OPT_ROADBOOK, &gdb_opt_roadbook, "Include major turn points (with description) from calculated route", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, ARG_TERMINATOR @@ -1890,7 +1890,7 @@ ff_vecs_t gdb_vecs = { gdb_wr_deinit, read_data, write_data, - NULL, + nullptr, gdb_args, CET_CHARSET_MS_ANSI, 0 /* O.K.: changed to NON-FIXED */ /* because of utf8 strings since GDB V3 */ diff --git a/geo.cc b/geo.cc index e95f9e875..eb368ccc4 100644 --- a/geo.cc +++ b/geo.cc @@ -22,7 +22,7 @@ #include #include -static char* deficon = NULL; +static char* deficon = nullptr; static char* nuke_placer; static gbfile* ofd; static QString ostring; @@ -30,8 +30,8 @@ static QXmlStreamWriter writer(&ostring); static arglist_t geo_args[] = { - {"deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, - {"nuke_placer", &nuke_placer, "Omit Placer name", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, + {"deficon", &deficon, "Default icon name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + {"nuke_placer", &nuke_placer, "Omit Placer name", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -45,7 +45,7 @@ geocache_container wpt_container(const QString&); void GeoReadLoc() { - Waypoint* wpt = NULL; + Waypoint* wpt = nullptr; QString current_tag; while (!reader.atEnd()) { @@ -173,7 +173,7 @@ geo_wr_deinit() writer.writeEndDocument(); gbfputs(ostring,ofd); gbfclose(ofd); - ofd = NULL; + ofd = nullptr; } static void @@ -265,7 +265,7 @@ ff_vecs_t geo_vecs = { geo_wr_deinit, geo_read, geo_write, - NULL, + nullptr, geo_args, CET_CHARSET_UTF8, 0, /* CET-REVIEW */ NULL_POS_OPS, diff --git a/geojson.cc b/geojson.cc index 3c6ba559a..6a3032183 100644 --- a/geojson.cc +++ b/geojson.cc @@ -25,9 +25,9 @@ static gbfile* ofd; static QString input_file_name; static const char MYNAME[] = "geojson"; -static char* compact_opt = NULL; -static QJsonObject* track_object = NULL; -static QJsonArray* track_coords = NULL; +static char* compact_opt = nullptr; +static QJsonObject* track_object = nullptr; +static QJsonArray* track_coords = nullptr; static const QString FEATURE_COLLECTION = QStringLiteral("FeatureCollection"); static const QString FEATURE = QStringLiteral("Feature"); @@ -49,7 +49,7 @@ static const QString URLNAME = QStringLiteral("urlname"); static arglist_t geojson_args[] = { {"compact", &compact_opt, "Compact Output. Default is off.", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr } , + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr } , ARG_TERMINATOR }; @@ -109,7 +109,7 @@ geojson_waypt_pr(const Waypoint* waypoint) { static void geojson_rd_deinit() { gbfclose(ofd); - ofd = NULL; + ofd = nullptr; } static void @@ -124,7 +124,7 @@ geojson_wr_deinit() { gbfputs(save.toJson(style),ofd); gbfclose(ofd); - ofd = NULL; + ofd = nullptr; delete feature_collection; feature_collection = nullptr; } @@ -300,9 +300,9 @@ static void geojson_track_tlr(const route_head*) { (*track_object)[GEOMETRY] = geometry; feature_collection->append(*track_object); delete track_object; - track_object = NULL; + track_object = nullptr; delete track_coords; - track_coords = NULL; + track_coords = nullptr; } static void @@ -324,7 +324,7 @@ ff_vecs_t geojson_vecs = { geojson_wr_deinit, geojson_read, geojson_write, - NULL, + nullptr, geojson_args, CET_CHARSET_UTF8, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/ggv_bin.cc b/ggv_bin.cc index 970ea9ba7..affb122cf 100644 --- a/ggv_bin.cc +++ b/ggv_bin.cc @@ -37,7 +37,7 @@ static QString read_fname; ***************************************************************************/ static void -ggv_bin_read_bytes(QDataStream& stream, QByteArray& buf, qint64 len, const char* descr = NULL) +ggv_bin_read_bytes(QDataStream& stream, QByteArray& buf, qint64 len, const char* descr = nullptr) { buf.resize(len); if (stream.readRawData(buf.data(), len) != len || stream.status() != QDataStream::Ok) @@ -45,7 +45,7 @@ ggv_bin_read_bytes(QDataStream& stream, QByteArray& buf, qint64 len, const char* } static quint16 -ggv_bin_read16(QDataStream& stream, const char* descr = NULL) +ggv_bin_read16(QDataStream& stream, const char* descr = nullptr) { quint16 res; stream >> res; @@ -57,7 +57,7 @@ ggv_bin_read16(QDataStream& stream, const char* descr = NULL) } static quint32 -ggv_bin_read32(QDataStream& stream, const char* descr = NULL) +ggv_bin_read32(QDataStream& stream, const char* descr = nullptr) { quint32 res; stream >> res; @@ -73,7 +73,7 @@ ggv_bin_read32(QDataStream& stream, const char* descr = NULL) } static void -ggv_bin_read_text16(QDataStream& stream, QByteArray& buf, const char* descr = NULL) +ggv_bin_read_text16(QDataStream& stream, QByteArray& buf, const char* descr = nullptr) { quint16 len = ggv_bin_read16(stream, descr); ggv_bin_read_bytes(stream, buf, len, descr); @@ -83,7 +83,7 @@ ggv_bin_read_text16(QDataStream& stream, QByteArray& buf, const char* descr = NU } static void -ggv_bin_read_text32(QDataStream& stream, QByteArray& buf, const char* descr = NULL) +ggv_bin_read_text32(QDataStream& stream, QByteArray& buf, const char* descr = nullptr) { quint32 len = ggv_bin_read32(stream, descr); ggv_bin_read_bytes(stream, buf, len, descr); @@ -93,7 +93,7 @@ ggv_bin_read_text32(QDataStream& stream, QByteArray& buf, const char* descr = NU } static double -ggv_bin_read_double(QDataStream& stream, const char* descr = NULL) +ggv_bin_read_double(QDataStream& stream, const char* descr = nullptr) { double res; stream >> res; @@ -509,13 +509,13 @@ ff_vecs_t ggv_bin_vecs = { ff_cap_none // routes }, ggv_bin_read_init, // rd_init - NULL, // wr_init + nullptr, // wr_init ggv_bin_read_deinit, // rd_deinit - NULL, // wr_deinit + nullptr, // wr_deinit ggv_bin_read, // read - NULL, // write - NULL, // exit - NULL, //args + nullptr, // write + nullptr, // exit + nullptr, //args CET_CHARSET_ASCII, 0 //encode,fixed_encode //NULL //name dynamic/internal? , NULL_POS_OPS, diff --git a/ggv_log.cc b/ggv_log.cc index 905d815ea..694d9d5c1 100644 --- a/ggv_log.cc +++ b/ggv_log.cc @@ -94,7 +94,7 @@ ggv_log_read() { signed char* buf; int bufsz = 0, len; - route_head* trk = NULL; + route_head* trk = nullptr; switch (ggv_log_ver) { case 10: @@ -118,7 +118,7 @@ ggv_log_read() break; } - if (trk == NULL) { + if (trk == nullptr) { trk = route_head_alloc(); track_add_head(trk); } @@ -207,7 +207,7 @@ static void ggv_log_track_head_cb(const route_head* trk) { queue* elem, *tmp; - Waypoint* prev = NULL; + Waypoint* prev = nullptr; QUEUE_FOR_EACH((queue*)&trk->waypoint_list, elem, tmp) { double latmin, lonmin, latsec, lonsec; @@ -233,7 +233,7 @@ ggv_log_track_head_cb(const route_head* trk) memset(&tm, 0, sizeof(tm)); } - if (prev != NULL) { + if (prev != nullptr) { course = heading_true_degrees( prev->latitude, prev->longitude, wpt->latitude, wpt->longitude); @@ -267,7 +267,7 @@ ggv_log_track_head_cb(const route_head* trk) static void ggv_log_write() { - track_disp_all(ggv_log_track_head_cb, NULL, NULL); + track_disp_all(ggv_log_track_head_cb, nullptr, nullptr); } /**************************************************************************/ @@ -285,7 +285,7 @@ ff_vecs_t ggv_log_vecs = { ggv_log_wr_deinit, ggv_log_read, ggv_log_write, - NULL, + nullptr, ggv_log_args, CET_CHARSET_ASCII, 1 , NULL_POS_OPS, diff --git a/ggv_ovl.cc b/ggv_ovl.cc index 1a305650e..f6a546bf2 100644 --- a/ggv_ovl.cc +++ b/ggv_ovl.cc @@ -232,11 +232,11 @@ ggv_ovl_write() { group_ct = 1; /* tracks are not grouped */ color = OVL_COLOR_FUCHSIA; - track_disp_all(track_disp_cb, NULL, NULL); + track_disp_all(track_disp_cb, nullptr, nullptr); group_ct++; color = OVL_COLOR_AQUA; - route_disp_all(route_disp_cb, NULL, NULL); + route_disp_all(route_disp_cb, nullptr, nullptr); group_ct++; color = OVL_COLOR_LIME; @@ -280,7 +280,7 @@ track_disp_cb(const route_head* trk) return; } - draw_symbol_basics(OVL_SYMBOL_LINE, 1, color, NULL); + draw_symbol_basics(OVL_SYMBOL_LINE, 1, color, nullptr); gbfprintf(fout, "Zoom=1\n"); gbfprintf(fout, "Size=105\n"); @@ -318,13 +318,13 @@ route_disp_cb(const route_head* rte) color = OVL_COLOR_RED; i = 0; - prev = NULL; + prev = nullptr; QUEUE_FOR_EACH(&(rte->waypoint_list), elem, tmp) { Waypoint* wpt = (Waypoint*) elem; - if (prev != NULL) { + if (prev != nullptr) { draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, (OVL_COLOR_TYP)9 /* color */, prev); gbfprintf(fout, "Width=12\n"); @@ -354,8 +354,8 @@ write_bounds() waypt_init_bounds(&all_bounds); waypt_disp_all(waypt_bound_calc); - route_disp_all(NULL, NULL, waypt_bound_calc); - track_disp_all(NULL, NULL, waypt_bound_calc); + route_disp_all(nullptr, nullptr, waypt_bound_calc); + track_disp_all(nullptr, nullptr, waypt_bound_calc); if (waypt_bounds_valid(&all_bounds)) { @@ -458,7 +458,7 @@ ff_vecs_t ggv_ovl_vecs = { ggv_ovl_wr_deinit, ggv_ovl_read, ggv_ovl_write, - NULL, + nullptr, ggv_ovl_args, CET_CHARSET_MS_ANSI, 0 , NULL_POS_OPS, diff --git a/globalsat_sport.cc b/globalsat_sport.cc index 18ec90fd9..0d09e3d34 100644 --- a/globalsat_sport.cc +++ b/globalsat_sport.cc @@ -47,20 +47,20 @@ static void* serial_handle; static int isSizeSwaped; -static char* showlist = NULL; // if true show a list instead of download tracks -static char* track = 0; // if not 0 only download this track, if 0 download all +static char* showlist = nullptr; // if true show a list instead of download tracks +static char* track = nullptr; // if not 0 only download this track, if 0 download all -static char* opt_dump_file = 0; // dump raw data to this file (optional) -static char* opt_input_dump_file = NULL; // if true input is from a dump-file instead of serial console -static gbfile* dumpfile = NULL; // used for creating bin/RAW datadump files, usefull for testing -static gbfile* in_file = NULL; // used for reading from bin/RAW datadump files, usefull for testing +static char* opt_dump_file = nullptr; // dump raw data to this file (optional) +static char* opt_input_dump_file = nullptr; // if true input is from a dump-file instead of serial console +static gbfile* dumpfile = nullptr; // used for creating bin/RAW datadump files, usefull for testing +static gbfile* in_file = nullptr; // used for reading from bin/RAW datadump files, usefull for testing static arglist_t globalsat_args[] = { - {"showlist", &showlist, "list tracks", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr}, + {"showlist", &showlist, "list tracks", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr}, {"track", &track, "get track", "0", ARGTYPE_INT, ARG_NOMINMAX, nullptr}, - {"dump-file", &opt_dump_file, "Dump raw data to this file", NULL, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr}, - {"input-is-dump-file", &opt_input_dump_file, "Dump raw data to this file", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr}, + {"dump-file", &opt_dump_file, "Dump raw data to this file", nullptr, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr}, + {"input-is-dump-file", &opt_input_dump_file, "Dump raw data to this file", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr}, ARG_TERMINATOR }; @@ -197,7 +197,7 @@ typedef struct tagRECPOINT { static void serial_init(const char* fname) { - if (serial_handle = gbser_init(fname), NULL == serial_handle) { + if (serial_handle = gbser_init(fname), nullptr == serial_handle) { fatal(MYNAME ": Can't open port '%s'\n", fname); } if (gbser_set_speed(serial_handle, 115200) != gbser_OK) { @@ -214,7 +214,7 @@ serial_deinit() printf(MYNAME " serial_deinit()\n"); } gbser_deinit(serial_handle); - serial_handle = NULL; + serial_handle = nullptr; if (global_opts.debug_level > 1) { printf(MYNAME " serial_deinit() Done\n"); } @@ -309,7 +309,7 @@ globalsat_write_package(uint8_t* payload, uint32_t size) crc ^= (0xff00 & size) >> 8; } - if (payload != NULL) { + if (payload != nullptr) { for (i = 0; i < size; i++) { write_byte(payload[i]); crc ^= payload[i]; @@ -345,7 +345,7 @@ globalsat_read_package(int* out_length, uint8_t* out_DeviceCommand) } payload = (uint8_t*) malloc(length); - if (payload == NULL) { + if (payload == nullptr) { goto error_out; } @@ -367,7 +367,7 @@ globalsat_read_package(int* out_length, uint8_t* out_DeviceCommand) free(payload); error_out: *out_length = 0; - return NULL; + return nullptr; } /* @@ -393,7 +393,7 @@ globalsat_probe_device() int len; uint8_t DeviceCommand; payload = globalsat_read_package(&len, &DeviceCommand); - if ((len > 0) && (payload != NULL)) { + if ((len > 0) && (payload != nullptr)) { if (global_opts.debug_level > 1) { printf("Got package!!!\n"); } @@ -457,7 +457,7 @@ rd_deinit() } if (dumpfile) { gbfclose(dumpfile); - dumpfile = NULL; + dumpfile = nullptr; } if (global_opts.debug_level > 1) { printf(MYNAME " rd_deinit() Done\n"); @@ -489,7 +489,7 @@ waypoint_read() int len; uint8_t DeviceCommand; in_payload = globalsat_read_package(&len, &DeviceCommand); - if ((len > 0) && (in_payload != NULL)) { + if ((len > 0) && (in_payload != nullptr)) { if (global_opts.debug_level > 1) { printf("Got package!!!\n"); } @@ -516,7 +516,7 @@ track_read() int length; uint8_t DeviceCommand; payload = globalsat_read_package(&length, &DeviceCommand); - if ((length > 0) && (payload != NULL)) { + if ((length > 0) && (payload != nullptr)) { if (global_opts.debug_level > 1) { printf("Got package!!! headers\n"); } @@ -579,9 +579,9 @@ track_read() uint8_t trackDeviceCommand; int track_length; - uint8_t* track_payload = NULL; + uint8_t* track_payload = nullptr; track_payload = globalsat_read_package(&track_length, &trackDeviceCommand); - is_fatal(((track_length == 0) || (track_payload == NULL)) , "tracklength in 0 bytes or payload nonexistant"); + is_fatal(((track_length == 0) || (track_payload == nullptr)) , "tracklength in 0 bytes or payload nonexistant"); // printf("Got track package!!! Train data\n"); uint8_t* dbtrain = (uint8_t*) track_payload; @@ -628,7 +628,7 @@ track_read() int total_laps = db_train.LapCnts; int total_laps_left = total_laps; free(track_payload); - track_payload = NULL; + track_payload = nullptr; gpsbabel::DateTime gpsDateTime; @@ -636,7 +636,7 @@ track_read() while (total_laps_left > 0) { globalsat_send_simple(CommandGetNextTrackSection); track_payload = globalsat_read_package(&track_length, &trackDeviceCommand); - is_fatal(((track_length == 0) || (track_payload == NULL)), "tracklength in 0 bytes or payload nonexistant"); + is_fatal(((track_length == 0) || (track_payload == nullptr)), "tracklength in 0 bytes or payload nonexistant"); // printf("Got track package!!! Laps data\n"); uint8_t* hdr = (uint8_t*) track_payload; @@ -711,7 +711,7 @@ track_read() } } free(track_payload); - track_payload = NULL; + track_payload = nullptr; total_laps_left -= laps_in_package; } @@ -725,7 +725,7 @@ track_read() } track_payload = globalsat_read_package(&track_length, &trackDeviceCommand); - if ((track_length > 0) && (track_payload != NULL)) { + if ((track_length > 0) && (track_payload != nullptr)) { // printf("Got track package!!! Train data\n"); uint8_t* hdr = (uint8_t*) track_payload; gh_trainheader header; @@ -852,8 +852,8 @@ ff_vecs_t globalsat_sport_vecs = { rd_deinit, //rd_deinit wr_deinit, //wr_deinit data_read, //read - NULL, //write - NULL, //exit + nullptr, //write + nullptr, //exit globalsat_args, //args CET_CHARSET_ASCII, 0 //encode,fixed_encode //NULL //name dynamic/internal? @@ -873,8 +873,8 @@ ff_vecs_t globalsat_sport_fvecs = { rd_deinit, //rd_deinit wr_deinit, //wr_deinit data_read, //read - NULL, //write - NULL, //exit + nullptr, //write + nullptr, //exit globalsat_args, //args CET_CHARSET_ASCII, 0 //encode,fixed_encode //NULL //name dynamic/internal? diff --git a/glogbook.cc b/glogbook.cc index 6fb07f61f..5922c1654 100644 --- a/glogbook.cc +++ b/glogbook.cc @@ -57,13 +57,13 @@ static xg_tag_mapping gl_map[] = { { gl_trk_long, cb_cdata, "/History/Run/Track/Trackpoint/Position/Longitude" }, { gl_trk_alt, cb_cdata, "/History/Run/Track/Trackpoint/Position/Altitude" }, { gl_trk_utc, cb_cdata, "/History/Run/Track/Trackpoint/Time" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; static void glogbook_rd_init(const QString& fname) { - xml_init(fname, gl_map, NULL); + xml_init(fname, gl_map, nullptr); } static void @@ -93,7 +93,7 @@ glogbook_wr_deinit() writer.writeEndDocument(); gbfputs(ostring,ofd); gbfclose(ofd); - ofd = NULL; + ofd = nullptr; } static void @@ -186,7 +186,7 @@ ff_vecs_t glogbook_vecs = { glogbook_wr_deinit, glogbook_read, glogbook_write, - NULL, + nullptr, glogbook_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/gnav_trl.cc b/gnav_trl.cc index bc796d94f..beb19d1fe 100644 --- a/gnav_trl.cc +++ b/gnav_trl.cc @@ -87,7 +87,7 @@ write_altitude(void* ptr, const float alt) static void gnav_trl_read() { - route_head* trk = NULL; + route_head* trk = nullptr; while (! gbfeof(fin)) { gnav_trl_t rec; @@ -104,7 +104,7 @@ gnav_trl_read() wpt->longitude = le_read_float(&rec.lon); wpt->altitude = read_altitude(&rec.alt); - if (trk == NULL) { + if (trk == nullptr) { trk = route_head_alloc(); track_add_head(trk); } @@ -132,7 +132,7 @@ gnav_trl_write_trkpt(const Waypoint* wpt) static void gnav_trl_write() { - track_disp_all(NULL, NULL, gnav_trl_write_trkpt); + track_disp_all(nullptr, nullptr, gnav_trl_write_trkpt); } @@ -151,7 +151,7 @@ ff_vecs_t gnav_trl_vecs = { gnav_trl_rw_deinit, gnav_trl_read, gnav_trl_write, - NULL, + nullptr, gnav_trl_args, CET_CHARSET_UTF8, 1 /* CET - do nothing ! */ , NULL_POS_OPS, diff --git a/googledir.cc b/googledir.cc index c477802de..3add146cc 100644 --- a/googledir.cc +++ b/googledir.cc @@ -46,7 +46,7 @@ xg_tag_mapping google_map[] = { { goog_points, cb_cdata, "/DirectionsResponse/route/leg/step/polyline/points" }, { goog_poly_e, cb_end, "/DirectionsResponse/route/leg/step" }, { goog_instr, cb_cdata, "/DirectionsResponse/route/leg/step/html_instructions" }, - { NULL, (xg_cb_type)0, NULL } + { nullptr, (xg_cb_type)0, nullptr } }; void @@ -100,7 +100,7 @@ goog_poly_e(xg_string args, const QXmlStreamAttributes*) } else { goog_step++; routehead->rte_name = QString("step%1").arg(goog_step, 3, 10, QChar('0')); - if (instructions == NULL) { + if (instructions == nullptr) { routehead->rte_desc = QString("Step %1").arg(goog_step); } else { utf_string utf; @@ -136,7 +136,7 @@ google_rd_init(const QString& fname) setshort_length(desc_handle, 12); // leave default of UTF-8 unless xml file overrides with encoding= - xml_init(fname, google_map, NULL); + xml_init(fname, google_map, nullptr); } static void @@ -159,13 +159,13 @@ ff_vecs_t google_dir_vecs = { ff_type_file, { ff_cap_none, ff_cap_read, ff_cap_none}, google_rd_init, - NULL, + nullptr, google_rd_deinit, - NULL, + nullptr, google_read, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, CET_CHARSET_UTF8, 1 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/gopal.cc b/gopal.cc index 2df919d7d..f62f0fa1e 100644 --- a/gopal.cc +++ b/gopal.cc @@ -66,15 +66,15 @@ static gbfile* fin, *fout; static struct tm tm,filenamedate, trackdate; time_t tx; -static char* optdate=NULL; -static char* optmaxspeed=NULL; -static char* optminspeed=NULL; -static char* optclean= NULL; +static char* optdate=nullptr; +static char* optmaxspeed=nullptr; +static char* optminspeed=nullptr; +static char* optclean= nullptr; static double minspeed,maxspeed; static struct tm opt_tm; /* converted "date" parameter */ static arglist_t gopal_args[] = { - {"date", &optdate, "Complete date-free tracks with given date (YYYYMMDD).", NULL, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, + {"date", &optdate, "Complete date-free tracks with given date (YYYYMMDD).", nullptr, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, {"maxspeed", &optmaxspeed, "The maximum speed (km/h) traveling from waypoint to waypoint.", "200", ARGTYPE_INT, "1", "1000", nullptr }, {"minspeed", &optminspeed, "The minimum speed (km/h) traveling from waypoint to waypoint. Set >0 to remove duplicate waypoints", "0", ARGTYPE_INT, "0", "999", nullptr }, {"clean", &optclean, "Cleanup common errors in trackdata", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, @@ -131,7 +131,7 @@ gopal_rd_init(const QString& fname) memset(&opt_tm, 0, sizeof(opt_tm)); ck = (char*)strptime(optdate, "%Y%m%d", &opt_tm); - if ((ck == NULL) || (*ck != '\0') || (strlen(optdate) != 8)) { + if ((ck == nullptr) || (*ck != '\0') || (strlen(optdate) != 8)) { fatal(MYNAME ": Invalid date \"%s\"!\n", optdate); } else if (opt_tm.tm_year < 70) { fatal(MYNAME ": Date \"%s\" is out of range (have to be 19700101 or later)!\n", optdate); @@ -175,7 +175,7 @@ gopal_read() double hmsd,speed; int fix, hms; route_head* route; - Waypoint* wpt, *lastwpt=NULL; + Waypoint* wpt, *lastwpt=nullptr; double lat_old; char tbuffer[64]; struct tm tm2; @@ -217,7 +217,7 @@ gopal_read() //3801444, 080558, 2.944362, 43.262117, 295.28, 0.12964, 2, 2.900000, 3 c = csv_lineparse(str, ",", "", column++); int millisecs = 0; - while (c != NULL) { + while (c != nullptr) { switch (column) { case 0: /* "-" */ /* unknown fields for the moment */ unsigned long microsecs; @@ -303,7 +303,7 @@ gopal_read() case 11: // Bearing. Ignored. break; } - c = csv_lineparse(NULL, ",", "", column++); + c = csv_lineparse(nullptr, ",", "", column++); } line++; @@ -314,7 +314,7 @@ gopal_read() } //calculate the speed to reach this waypoint from the last. This way I try to sort out invalid waypoints speed=0; - if (lastwpt !=NULL) { + if (lastwpt !=nullptr) { speed=3.6*radtometers(gcdist(RAD(lastwpt->latitude), RAD(lastwpt->longitude), RAD(wpt->latitude), RAD(wpt->longitude))) / abs((int)(wpt->creation_time.toTime_t() - lastwpt->GetCreationTime().toTime_t())); //printf("speed line %d %lf \n",line,speed); diff --git a/gpssim.cc b/gpssim.cc index 1286139c1..2f5e89a53 100644 --- a/gpssim.cc +++ b/gpssim.cc @@ -39,7 +39,7 @@ static arglist_t gpssim_args[] = { { "wayptspd", &wayptspd, "Default speed for waypoints (knots/hr)", - NULL, ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr }, { "split", &splitfiles_opt, "Split input into separate files", @@ -77,7 +77,7 @@ gpssim_wr_deinit() { if (fout) { gbfclose(fout); - fout = NULL; + fout = nullptr; } fnamestr.clear(); @@ -152,7 +152,7 @@ gpssim_trk_hdr(const route_head* rh) QString ofname = QString("%1%2%3.gpssim").arg(fnamestr).arg(doing_tracks ? "-track" : "-route").arg(trk_count++, 4, 10, QChar('0')); fout = gbfopen(ofname, "wb", MYNAME); } - track_recompute(rh, NULL); + track_recompute(rh, nullptr); } static void @@ -160,7 +160,7 @@ gpssim_trk_ftr(const route_head*) { if (splitfiles) { gbfclose(fout); - fout = NULL; + fout = nullptr; } } @@ -178,7 +178,7 @@ gpssim_write() waypt_disp_all(gpssim_write_pt); if (splitfiles) { gbfclose(fout); - fout = NULL; + fout = nullptr; } } @@ -194,13 +194,13 @@ gpssim_write() ff_vecs_t gpssim_vecs = { ff_type_file, { ff_cap_write, ff_cap_write, ff_cap_write }, - NULL, + nullptr, gpssim_wr_init, - NULL, + nullptr, gpssim_wr_deinit, - NULL, + nullptr, gpssim_write, - NULL, + nullptr, gpssim_args, CET_CHARSET_ASCII, 0 , NULL_POS_OPS, diff --git a/gpsutil.cc b/gpsutil.cc index 460b037b0..f3a930f06 100644 --- a/gpsutil.cc +++ b/gpsutil.cc @@ -183,8 +183,8 @@ ff_vecs_t gpsutil_vecs = { wr_deinit, data_read, data_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/gpx.cc b/gpx.cc index 037509264..2b9e6c672 100644 --- a/gpx.cc +++ b/gpx.cc @@ -39,10 +39,10 @@ static QXmlStreamReader* reader; static xml_tag* cur_tag; static QString cdatastr; -static char* opt_logpoint = NULL; -static char* opt_humminbirdext = NULL; -static char* opt_garminext = NULL; -static char* opt_elevation_precision = NULL; +static char* opt_logpoint = nullptr; +static char* opt_humminbirdext = nullptr; +static char* opt_garminext = nullptr; +static char* opt_elevation_precision = nullptr; static int logpoint_ct = 0; static int elevation_precision; @@ -66,9 +66,9 @@ static QString link_text; static QString link_type; -static char* snlen = NULL; -static char* suppresswhite = NULL; -static char* urlbase = NULL; +static char* snlen = nullptr; +static char* suppresswhite = nullptr; +static char* urlbase = nullptr; static route_head* trk_head; static route_head* rte_head; static const route_head* current_trk_head; // Output. @@ -250,7 +250,7 @@ static inline QString toString(float f) static void gpx_reset_short_handle() { - if (mkshort_handle != NULL) { + if (mkshort_handle != nullptr) { mkshort_del_handle(&mkshort_handle); } @@ -419,7 +419,7 @@ tag_mapping tag_path_map[] = { GPXWPTTYPETAG(tt_wpttype_vdop, 0, "vdop"), GPXWPTTYPETAG(tt_wpttype_pdop, 0, "pdop"), - {(tag_type)0, 0, NULL} + {(tag_type)0, 0, nullptr} }; // Maintain a fast mapping from full tag names to the struct above. @@ -481,7 +481,7 @@ tag_wpt(const QXmlStreamAttributes& attr) wpt_tmp = new Waypoint; link_ = new UrlLink; - cur_tag = NULL; + cur_tag = nullptr; if (attr.hasAttribute("lat")) { wpt_tmp->latitude = attr.value("lat").toString().toDouble(); } @@ -559,7 +559,7 @@ start_something_else(const QString el, const QXmlStreamAttributes& attr) avcp++; } - *avcp = NULL; // this indicates the end of the attribute name value pairs. + *avcp = nullptr; // this indicates the end of the attribute name value pairs. if (cur_tag) { if (cur_tag->child) { @@ -582,12 +582,12 @@ start_something_else(const QString el, const QXmlStreamAttributes& attr) cur_tag = cur_tag->sibling; } cur_tag->sibling = new_tag; - new_tag->parent = NULL; + new_tag->parent = nullptr; } else { fs_gpx = fs_xml_alloc(FS_GPX); fs_gpx->tag = new_tag; fs_chain_add(fs_ptr, (format_specific_data*)fs_gpx); - new_tag->parent = NULL; + new_tag->parent = nullptr; } } cur_tag = new_tag; @@ -811,8 +811,8 @@ xml_parse_time(const QString& dateTimeString) int off_hr = 0; int off_min = 0; int off_sign = 1; - char* offsetstr = NULL; - char* pointstr = NULL; + char* offsetstr = nullptr; + char* pointstr = nullptr; char* timestr = xstrdup(dateTimeString); offsetstr = strchr(timestr, 'Z'); @@ -923,12 +923,12 @@ gpx_end(const QString&) wpt_tmp->AddUrlLink(*link_); } delete link_; - link_ = NULL; + link_ = nullptr; } waypt_add(wpt_tmp); logpoint_ct = 0; - cur_tag = NULL; - wpt_tmp = NULL; + cur_tag = nullptr; + wpt_tmp = nullptr; break; case tt_cache_name: wpt_tmp->notes = cdatastr; @@ -1025,10 +1025,10 @@ gpx_end(const QString&) wpt_tmp->AddUrlLink(*link_); } delete link_; - link_ = NULL; + link_ = nullptr; } route_add_wpt(rte_head, wpt_tmp); - wpt_tmp = NULL; + wpt_tmp = nullptr; break; case tt_rte_desc: rte_head->rte_desc = cdatastr; @@ -1056,10 +1056,10 @@ gpx_end(const QString&) wpt_tmp->AddUrlLink(*link_); } delete link_; - link_ = NULL; + link_ = nullptr; } track_add_wpt(trk_head, wpt_tmp); - wpt_tmp = NULL; + wpt_tmp = nullptr; break; case tt_trk_desc: trk_head->rte_desc = cdatastr; @@ -1202,7 +1202,7 @@ gpx_rd_init(const QString& fname) cdatastr = QString(); - if (NULL == gpx_global) { + if (nullptr == gpx_global) { gpx_global = (struct gpx_global*) xcalloc(sizeof(*gpx_global), 1); QUEUE_INIT(&gpx_global->name.queue); QUEUE_INIT(&gpx_global->desc.queue); @@ -1213,7 +1213,7 @@ gpx_rd_init(const QString& fname) QUEUE_INIT(&gpx_global->keywords.queue); } - fs_ptr = NULL; + fs_ptr = nullptr; } static @@ -1221,18 +1221,18 @@ void gpx_rd_deinit() { delete reader; - reader = NULL; + reader = nullptr; iqfile->close(); delete iqfile; - iqfile = NULL; - wpt_tmp = NULL; - cur_tag = NULL; + iqfile = nullptr; + wpt_tmp = nullptr; + cur_tag = nullptr; } static void gpx_wr_init(const QString& fname) { - mkshort_handle = NULL; + mkshort_handle = nullptr; oqfile = new gpsbabel::File(fname); oqfile->open(QIODevice::WriteOnly | QIODevice::Text); @@ -1263,7 +1263,7 @@ gpx_wr_init(const QString& fname) gpx_wversion = (char*)"1.1"; } - gpx_wversion_num = strtod(gpx_wversion, NULL) * 10; + gpx_wversion_num = strtod(gpx_wversion, nullptr) * 10; if (gpx_wversion_num <= 0) { Fatal() << MYNAME << ": gpx version number of " @@ -1337,10 +1337,10 @@ gpx_wr_deinit() { writer->writeEndDocument(); delete writer; - writer = NULL; + writer = nullptr; oqfile->close(); delete oqfile; - oqfile = NULL; + oqfile = nullptr; mkshort_del_handle(&mkshort_handle); } @@ -1460,7 +1460,7 @@ fprint_xml_chain(xml_tag* tag, const Waypoint* wpt) void free_gpx_extras(xml_tag* tag) { - xml_tag* next = NULL; + xml_tag* next = nullptr; char** ap; while (tag) { @@ -1516,7 +1516,7 @@ write_gpx_url(const Waypoint* waypointp) static void gpx_write_common_acc(const Waypoint* waypointp) { - const char* fix = NULL; + const char* fix = nullptr; switch (waypointp->fix) { case fix_2d: @@ -1722,7 +1722,7 @@ gpx_track_hdr(const route_head* rte) if (!(opt_humminbirdext || opt_garminext)) { fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { - fprint_xml_chain(fs_gpx->tag, NULL); + fprint_xml_chain(fs_gpx->tag, nullptr); } } else if (opt_garminext) { if (rte->line_color.bbggrr > unknown_color) { @@ -1768,7 +1768,7 @@ gpx_track_disp(const Waypoint* waypointp) waypointp->shortname; gpx_write_common_description(waypointp, waypointp->wpt_flags.shortname_is_synthetic ? - NULL : oname); + nullptr : oname); gpx_write_common_acc(waypointp); if (!(opt_humminbirdext || opt_garminext)) { @@ -1791,7 +1791,7 @@ gpx_track_tlr(const route_head*) writer->writeEndElement(); - current_trk_head = NULL; + current_trk_head = nullptr; } static @@ -1817,7 +1817,7 @@ gpx_route_hdr(const route_head* rte) if (!(opt_humminbirdext || opt_garminext)) { fs_gpx = (fs_xml*)fs_chain_find(rte->fs, FS_GPX); if (fs_gpx) { - fprint_xml_chain(fs_gpx->tag, NULL); + fprint_xml_chain(fs_gpx->tag, nullptr); } } else if (opt_garminext) { if (rte->line_color.bbggrr > unknown_color) { @@ -1889,8 +1889,8 @@ gpx_write_bounds() waypt_init_bounds(&all_bounds); waypt_disp_all(gpx_waypt_bound_calc); - route_disp_all(NULL, NULL, gpx_waypt_bound_calc); - track_disp_all(NULL, NULL, gpx_waypt_bound_calc); + route_disp_all(nullptr, nullptr, gpx_waypt_bound_calc); + track_disp_all(nullptr, nullptr, gpx_waypt_bound_calc); if (waypt_bounds_valid(&all_bounds)) { writer->writeStartElement(QStringLiteral("bounds")); @@ -1940,7 +1940,7 @@ gpx_exit() if (gpx_global) { gpx_free_gpx_global(); - gpx_global = NULL; + gpx_global = nullptr; } } @@ -1948,40 +1948,40 @@ static arglist_t gpx_args[] = { { "snlen", &snlen, "Length of generated shortnames", - "32", ARGTYPE_INT, "1", NULL, NULL + "32", ARGTYPE_INT, "1", nullptr, nullptr }, { "suppresswhite", &suppresswhite, "No whitespace in generated shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "logpoint", &opt_logpoint, "Create waypoints from geocache log entries", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "urlbase", &urlbase, "Base URL for link tag in output", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "gpxver", &gpx_wversion, "Target GPX version for output", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "humminbirdextensions", &opt_humminbirdext, "Add info (depth) as Humminbird extension", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "garminextensions", &opt_garminext, "Add info (depth) as Garmin extension", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "elevprec", &opt_elevation_precision, "Precision of elevations, number of decimals", - "3", ARGTYPE_INT, ARG_NOMINMAX, NULL + "3", ARGTYPE_INT, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -1999,5 +1999,5 @@ ff_vecs_t gpx_vecs = { gpx_args, CET_CHARSET_UTF8, 0, /* non-fixed to create non UTF-8 XML's for testing | CET-REVIEW */ NULL_POS_OPS, - NULL, + nullptr, }; diff --git a/gtm.cc b/gtm.cc index a23a6ee16..fea8e60cf 100644 --- a/gtm.cc +++ b/gtm.cc @@ -79,7 +79,7 @@ fread_string(gbfile* fd) int len = fread_integer(fd); if (len == 0) { - return NULL; + return nullptr; } val = (char*) xmalloc(len+1); @@ -376,7 +376,7 @@ static const char* icon_descr[] = { "Deer Tracks", "Tree Stand", "Bridge", "Fence", "Intersection", "Non Direct Beacon", "VHF Omni Range", "Vor/Tacan", "Vor-Dme", "1st Approach Fix", "Localizer Outer", "Missed Appr. Pt", "Tacan", - "CheckPoint", NULL + "CheckPoint", nullptr }; @@ -449,8 +449,8 @@ static void gtm_wr_init(const QString& fname) { rt_count = tr_count = 0; - track_disp_all(NULL, NULL, count_track_waypts); - route_disp_all(NULL, NULL, count_route_waypts); + track_disp_all(nullptr, nullptr, count_track_waypts); + route_disp_all(nullptr, nullptr, count_route_waypts); file_out = gbfopen_le(fname, "wb", MYNAME); /* little endian */ @@ -509,9 +509,9 @@ gtm_wr_deinit() static void gtm_read() { - route_head* first_trk_head = NULL; - route_head* trk_head = NULL; - route_head* rte_head = NULL; + route_head* first_trk_head = nullptr; + route_head* trk_head = nullptr; + route_head* rte_head = nullptr; Waypoint* wpt; int real_tr_count = 0; unsigned int icon; @@ -714,9 +714,9 @@ gtm_write() if (waypt_count()) { gbfwrite(WAYPOINTSTYLES, 1, sizeof(WAYPOINTSTYLES)-1, file_out); } - track_disp_all(start_rte, NULL, write_trk_waypt); - track_disp_all(write_trk_style, NULL, NULL); - route_disp_all(start_rte, NULL, write_rte_waypt); + track_disp_all(start_rte, nullptr, write_trk_waypt); + track_disp_all(write_trk_style, nullptr, nullptr); + route_disp_all(start_rte, nullptr, write_rte_waypt); } static @@ -733,7 +733,7 @@ ff_vecs_t gtm_vecs = { gtm_wr_deinit, gtm_read, gtm_write, - NULL, + nullptr, gtm_args, CET_CHARSET_ASCII, 0, /* CET-REVIEW */ NULL_POS_OPS, diff --git a/gtrnctr.cc b/gtrnctr.cc index 650e08e24..5e6cb281e 100644 --- a/gtrnctr.cc +++ b/gtrnctr.cc @@ -155,7 +155,7 @@ static xg_tag_mapping gtc_map[] = { { gtc_wpt_long, cb_cdata, "/Courses/Course/Lap/BeginPosition/LongitudeDegrees" }, { gtc_trk_alt, cb_cdata, "/Courses/Course/Lap/BeginAltitudeMeters" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; static const char* @@ -166,13 +166,13 @@ gtc_tags_to_ignore[] = { "Biking", "Other", "Multisport", - NULL, + nullptr, }; static void gtc_rd_init(const QString& fname) { - xml_init(fname, gtc_map, NULL); + xml_init(fname, gtc_map, nullptr); xml_ignore_tags(gtc_tags_to_ignore); } @@ -396,7 +396,7 @@ static void gtc_act_hdr(const route_head* rte) { gtc_write_xml(1, "\n", gtc_sportlist[gtc_sport]); - gtc_lap_start(NULL); + gtc_lap_start(nullptr); gtc_new_study_lap(rte); route_disp(rte, gtc_study_lap); if (gtc_least_time.isValid()) { @@ -425,7 +425,7 @@ gtc_crs_hdr(const route_head* rte) { gtc_write_xml(1, "\n"); - gtc_lap_start(NULL); + gtc_lap_start(nullptr); gtc_new_study_lap(rte); route_disp(rte, gtc_study_lap); @@ -522,7 +522,7 @@ gtc_trk_pnt_e(xg_string, const QXmlStreamAttributes*) delete wpt_tmp; } - wpt_tmp = NULL; + wpt_tmp = nullptr; } void @@ -589,7 +589,7 @@ gtc_wpt_crs_e(xg_string, const QXmlStreamAttributes*) delete wpt_tmp; } - wpt_tmp = NULL; + wpt_tmp = nullptr; } void @@ -611,7 +611,7 @@ gtc_wpt_pnt_e(xg_string, const QXmlStreamAttributes*) delete wpt_tmp; } - wpt_tmp = NULL; + wpt_tmp = nullptr; } void gtc_wpt_ident(const QString& args, const QXmlStreamAttributes*) @@ -650,7 +650,7 @@ ff_vecs_t gtc_vecs = { gtc_wr_deinit, gtc_read, gtc_write, - NULL, + nullptr, gtc_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/height.cc b/height.cc index 3a7ea3eb6..5217b2992 100644 --- a/height.cc +++ b/height.cc @@ -30,8 +30,8 @@ #define MYNAME "height" #if FILTERS_ENABLED -static char* addopt = NULL; -static char* wgs84tomslopt = NULL; +static char* addopt = nullptr; +static char* wgs84tomslopt = nullptr; static double addf; @@ -39,11 +39,11 @@ static arglist_t height_args[] = { { "add", &addopt, "Adds a constant value to every altitude (meter, append \"f\" (x.xxf) for feet)", - NULL, ARGTYPE_BEGIN_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BEGIN_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX, nullptr }, { "wgs84tomsl", &wgs84tomslopt, "Converts WGS84 ellipsoidal height to orthometric height (MSL)", - NULL, ARGTYPE_END_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_END_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -144,16 +144,16 @@ static void height_process() /* this procedure must be present in vecs */ { waypt_disp_all(correct_height); - route_disp_all(NULL, NULL, correct_height); - track_disp_all(NULL, NULL, correct_height); + route_disp_all(nullptr, nullptr, correct_height); + track_disp_all(nullptr, nullptr, correct_height); } filter_vecs_t height_vecs = { height_init, height_process, - NULL, - NULL, + nullptr, + nullptr, height_args }; diff --git a/hiketech.cc b/hiketech.cc index ee163693f..586952720 100644 --- a/hiketech.cc +++ b/hiketech.cc @@ -75,13 +75,13 @@ static xg_tag_mapping ht_map[] = { { ht_trk_lat, cb_cdata, "/hiketech/gpsdata/trk/pnt/lat" }, { ht_trk_long, cb_cdata, "/hiketech/gpsdata/trk/pnt/long" }, { ht_trk_alt, cb_cdata, "/hiketech/gpsdata/trk/pnt/alt" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; static void hiketech_rd_init(const QString& fname) { - xml_init(fname, ht_map, NULL); + xml_init(fname, ht_map, nullptr); } static void @@ -109,7 +109,7 @@ hiketech_wr_deinit() writer.writeEndDocument(); gbfputs(ostring, ofd); gbfclose(ofd); - ofd = NULL; + ofd = nullptr; } static void @@ -184,7 +184,7 @@ hiketech_write() writer.setAutoFormatting(true); writer.writeStartElement(QStringLiteral("gpsdata")); track_disp_all(hiketech_trk_hdr, hiketech_trk_tlr, hiketech_trkpt_pr); - track_disp_all(NULL, NULL, hiketech_trkpt_pr); + track_disp_all(nullptr, nullptr, hiketech_trkpt_pr); waypt_disp_all(hiketech_waypt_pr); writer.writeEndElement(); // gpsdata writer.writeEndElement(); // hiketech @@ -230,7 +230,7 @@ static void ht_wpt_e(xg_string, const QXmlStreamAttributes*) { waypt_add(wpt_tmp); - wpt_tmp = NULL; + wpt_tmp = nullptr; } static @@ -312,7 +312,7 @@ ff_vecs_t hiketech_vecs = { hiketech_wr_deinit, hiketech_read, hiketech_write, - NULL, + nullptr, hiketech_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/holux.cc b/holux.cc index c0f569f4f..d83669c6d 100644 --- a/holux.cc +++ b/holux.cc @@ -159,14 +159,14 @@ const char* mknshort(const char* stIn,unsigned int sLen) #define MAX_STRINGLEN 255 static char strOut[MAX_STRINGLEN]; char strTmp[MAX_STRINGLEN]; - char* shortstr = NULL; + char* shortstr = nullptr; if (sLen > MAX_STRINGLEN) { return (stIn); } - if (stIn == NULL) { - return NULL; + if (stIn == nullptr) { + return nullptr; } setshort_length(mkshort_handle, sLen); @@ -212,14 +212,14 @@ static void holux_disp(const Waypoint* wpt) pWptHxTmp = (WPT*)&HxWFile[OFFS_WPT + (sizeof(WPT) * sIndex)]; memset(pWptHxTmp->name,0x20,sizeof(pWptHxTmp->name)); - if (wpt->shortname != NULL) { + if (wpt->shortname != nullptr) { strncpy(pWptHxTmp->name, mknshort(CSTRc(wpt->shortname),sizeof(pWptHxTmp->name)),sizeof(pWptHxTmp->name)); } else { sprintf(pWptHxTmp->name,"W%d",sIndex); } memset(pWptHxTmp->comment,0x20,sizeof(pWptHxTmp->comment)); - if (wpt->description != NULL) { + if (wpt->description != nullptr) { strncpy(pWptHxTmp->comment, mknshort(CSTRc(wpt->description),sizeof(pWptHxTmp->comment)),sizeof(pWptHxTmp->comment)); } @@ -310,8 +310,8 @@ ff_vecs_t holux_vecs = { wr_deinit, data_read, data_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/html.cc b/html.cc index 4ae4467f8..ee7907f4c 100644 --- a/html.cc +++ b/html.cc @@ -29,11 +29,11 @@ static gbfile* file_out; static short_handle mkshort_handle; -static char* stylesheet = NULL; -static char* html_encrypt = NULL; -static char* includelogs = NULL; -static char* degformat = NULL; -static char* altunits = NULL; +static char* stylesheet = nullptr; +static char* html_encrypt = nullptr; +static char* includelogs = nullptr; +static char* degformat = nullptr; +static char* altunits = nullptr; #define MYNAME "HTML" @@ -41,15 +41,15 @@ static arglist_t html_args[] = { { "stylesheet", &stylesheet, - "Path to HTML style sheet", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + "Path to HTML style sheet", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "encrypt", &html_encrypt, - "Encrypt hints using ROT13", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + "Encrypt hints using ROT13", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "logs", &includelogs, - "Include groundspeak logs if present", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + "Include groundspeak logs if present", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "degformat", °format, @@ -85,7 +85,7 @@ html_disp(const Waypoint* wpt) int32_t utmz; double utme, utmn; char utmzc; - fs_xml* fs_gpx = NULL; + fs_xml* fs_gpx = nullptr; GPS_Math_WGS84_To_UTM_EN(wpt->latitude, wpt->longitude, @@ -151,19 +151,19 @@ html_disp(const Waypoint* wpt) gbfprintf(file_out, "

%s

\n", CSTRc(wpt->notes)); } - fs_gpx = NULL; + fs_gpx = nullptr; if (includelogs) { fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX); } if (fs_gpx && fs_gpx->tag) { xml_tag* root = fs_gpx->tag; - xml_tag* curlog = NULL; - xml_tag* logpart = NULL; + xml_tag* curlog = nullptr; + xml_tag* logpart = nullptr; curlog = xml_findfirst(root, "groundspeak:log"); while (curlog) { time_t logtime = 0; - struct tm* logtm = NULL; + struct tm* logtm = nullptr; gbfprintf(file_out, "

\n"); logpart = xml_findfirst(curlog, "groundspeak:type"); @@ -193,7 +193,7 @@ html_disp(const Waypoint* wpt) logpart = xml_findfirst(curlog, "groundspeak:log_wpt"); if (logpart) { - char* coordstr = NULL; + char* coordstr = nullptr; double lat = 0; double lon = 0; coordstr = xml_attribute(logpart, "lat"); @@ -213,7 +213,7 @@ html_disp(const Waypoint* wpt) logpart = xml_findfirst(curlog, "groundspeak:text"); if (logpart) { - char* encstr = NULL; + char* encstr = nullptr; int encoded = 0; encstr = xml_attribute(logpart, "encoded"); encoded = (toupper(encstr[0]) != 'F'); @@ -289,13 +289,13 @@ data_write() ff_vecs_t html_vecs = { ff_type_file, { ff_cap_write, ff_cap_none, ff_cap_none }, - NULL, + nullptr, wr_init, - NULL, + nullptr, wr_deinit, - NULL, + nullptr, data_write, - NULL, + nullptr, html_args, CET_CHARSET_UTF8, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/humminbird.cc b/humminbird.cc index e080eff11..1d9bde58f 100644 --- a/humminbird.cc +++ b/humminbird.cc @@ -346,7 +346,7 @@ humminbird_read_route(gbfile* fin) if (hrte.count > 0) { int i; - route_head* rte = NULL; + route_head* rte = nullptr; for (i = 0; i < hrte.count; i++) { const Waypoint* wpt; @@ -357,7 +357,7 @@ humminbird_read_route(gbfile* fin) snprintf(buff, sizeof(buff), "%d", hrte.points[i]); if ((map.value(buff))) { wpt = map.value(buff); - if (rte == NULL) { + if (rte == nullptr) { rte = route_head_alloc(); route_add_head(rte); // TODO: find a way to eliminate the copy. @@ -759,7 +759,7 @@ humminbird_track_head(const route_head* trk) { int max_points = (131080 - sizeof(uint32_t)- sizeof(humminbird_trk_header_t)) / sizeof(humminbird_trk_point_t); - trk_head = NULL; + trk_head = nullptr; last_time = 0; if (trk->rte_waypt_ct > 0) { QString name; @@ -777,7 +777,7 @@ humminbird_track_tail(const route_head*) { int max_points = (131080 - sizeof(uint32_t)- sizeof(humminbird_trk_header_t)) / sizeof(humminbird_trk_point_t); - if (trk_head == NULL) { + if (trk_head == nullptr) { return; } @@ -805,8 +805,8 @@ humminbird_track_tail(const route_head*) xfree(trk_head); xfree(trk_points); - trk_head = NULL; - trk_points = NULL; + trk_head = nullptr; + trk_points = nullptr; } static void @@ -816,7 +816,7 @@ humminbird_track_cb(const Waypoint* wpt) double lat; int i; - if (trk_head == NULL) { + if (trk_head == nullptr) { return; } @@ -888,7 +888,7 @@ humminbird_track_write() static void humminbird_rte_head(const route_head* rte) { - humrte = NULL; + humrte = nullptr; if (rte->rte_waypt_ct > 0) { humrte = (humminbird_rte_t*) xcalloc(1, sizeof(*humrte)); } @@ -897,7 +897,7 @@ humminbird_rte_head(const route_head* rte) static void humminbird_rte_tail(const route_head* rte) { - if (humrte == NULL) { + if (humrte == nullptr) { return; } @@ -921,7 +921,7 @@ humminbird_rte_tail(const route_head* rte) } xfree(humrte); - humrte = NULL; + humrte = nullptr; } static void @@ -929,7 +929,7 @@ humminbird_write_rtept(const Waypoint* wpt) { int i; - if (humrte == NULL) { + if (humrte == nullptr) { return; } i = gb_ptr2int(wpt->extra_data); @@ -971,7 +971,7 @@ static void humminbird_write() { waypt_disp_all(humminbird_write_waypoint_wrapper); - route_disp_all(NULL, NULL, humminbird_write_waypoint_wrapper); + route_disp_all(nullptr, nullptr, humminbird_write_waypoint_wrapper); route_disp_all(humminbird_rte_head, humminbird_rte_tail, humminbird_write_rtept); } @@ -990,7 +990,7 @@ ff_vecs_t humminbird_vecs = { humminbird_wr_deinit, humminbird_read, humminbird_write, - NULL, // humminbird_exit, + nullptr, // humminbird_exit, humminbird_args, CET_CHARSET_ASCII, 1 /* ascii is the expected character set */ /* currently fixed !!! */ @@ -1015,7 +1015,7 @@ ff_vecs_t humminbird_ht_vecs = { humminbird_wr_deinit, humminbird_read, humminbird_track_write, - NULL, // humminbird_exit, + nullptr, // humminbird_exit, humminbird_args, CET_CHARSET_ASCII, 1 /* ascii is the expected character set */ /* currently fixed !!! */ diff --git a/igc.cc b/igc.cc index 9fdc16d49..680521e3c 100644 --- a/igc.cc +++ b/igc.cc @@ -33,7 +33,7 @@ static gbfile* file_in, *file_out; static char manufacturer[4]; static const route_head* head; -static char* timeadj = NULL; +static char* timeadj = nullptr; static int lineno; #define MYNAME "IGC" @@ -101,7 +101,7 @@ retry: if ((lineno++ == 0) && file_in->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); } - if (c == NULL) { + if (c == nullptr) { return rec_none; } @@ -263,13 +263,13 @@ static void data_read() unsigned int lon_deg, lon_min, lon_frac; char lat_hemi[2], lon_hemi[2]; char validity; - route_head* pres_head = NULL; - route_head* gnss_head = NULL; + route_head* pres_head = nullptr; + route_head* gnss_head = nullptr; int pres_alt, gnss_alt; char pres_valid = 0; char gnss_valid = 0; - Waypoint* pres_wpt = NULL; - Waypoint* gnss_wpt = NULL; + Waypoint* pres_wpt = nullptr; + Waypoint* gnss_wpt = nullptr; time_t date = 0; time_t prev_tod = 0; time_t tod; @@ -296,7 +296,7 @@ static void data_read() } // Optional long name of record sub type is followed by a // colon. Actual header data follows that. - if (NULL == (hdr_data = strchr(ibuf, ':'))) { + if (nullptr == (hdr_data = strchr(ibuf, ':'))) { hdr_data = ibuf + 5; } else { hdr_data++; @@ -438,7 +438,7 @@ static void data_read() // altitude data or if it is the only track available. if (pres_head && !pres_valid && gnss_head) { track_del_head(pres_head); - pres_head = NULL; + pres_head = nullptr; } // Include GNSS altitude track only if it has useful altitude // data or if it is the only track available. @@ -503,16 +503,16 @@ static void detect_other_track(const route_head* rh) */ static void get_tracks(const route_head** pres_track, const route_head** gnss_track) { - head = NULL; - track_disp_all(detect_pres_track, NULL, NULL); + head = nullptr; + track_disp_all(detect_pres_track, nullptr, nullptr); *pres_track = head; - head = NULL; - track_disp_all(detect_gnss_track, NULL, NULL); + head = nullptr; + track_disp_all(detect_gnss_track, nullptr, nullptr); *gnss_track = head; - head = NULL; - track_disp_all(detect_other_track, NULL, NULL); + head = nullptr; + track_disp_all(detect_other_track, nullptr, nullptr); if (!*pres_track && *gnss_track && head) { *pres_track = head; @@ -582,7 +582,7 @@ static void wr_header() struct tm* tm; time_t date; static const char dflt_str[] = "Unknown"; - const char* str = NULL; + const char* str = nullptr; Waypoint* wpt; get_tracks(&pres_track, &track); @@ -593,7 +593,7 @@ static void wr_header() date = !track ? current_time().toTime_t() : ((Waypoint*) QUEUE_FIRST(&track->waypoint_list))->GetCreationTime().toTime_t(); - if (NULL == (tm = gmtime(&date))) { + if (nullptr == (tm = gmtime(&date))) { fatal(MYNAME ": Bad track timestamp\n"); } gbfprintf(file_out, "HFDTE%s\r\n", date2str(tm)); @@ -603,11 +603,11 @@ static void wr_header() if (track && track->rte_desc.startsWith(HDRMAGIC)) { char *rd = xstrdup(track->rte_desc); for (str = strtok(rd + strlen(HDRMAGIC) + strlen(HDRDELIM), HDRDELIM); - str; str = strtok(NULL, HDRDELIM)) { + str; str = strtok(nullptr, HDRDELIM)) { gbfprintf(file_out, "%s\r\n", str); } xfree(rd); - rd = NULL; + rd = nullptr; #else if (track && track->rte_desc && strncmp(track->rte_desc, HDRMAGIC, strlen(HDRMAGIC)) == 0) { for (str = strtok(CSTRc(track->rte_desc) + strlen(HDRMAGIC) + strlen(HDRDELIM), HDRDELIM); @@ -620,7 +620,7 @@ static void wr_header() // FIXME: This almost certainly introduces a memory leak because str // is a c string that's used for totally too many things. Just let it // leak for now. 2013-12-31 robertl - if (NULL != (wpt = find_waypt_by_name("PILOT")) && !wpt->description.isEmpty()) { + if (nullptr != (wpt = find_waypt_by_name("PILOT")) && !wpt->description.isEmpty()) { xfree(str); str = xstrdup(CSTRc(wpt->description)); #else @@ -680,7 +680,7 @@ static void wr_task_hdr(const route_head* rte) } // Gather data to write to the task identification (first) record rte_time = wpt->GetCreationTime().isValid() ? wpt->GetCreationTime().toTime_t() : current_time().toTime_t(); - if (NULL == (tm = gmtime(&rte_time))) { + if (nullptr == (tm = gmtime(&rte_time))) { fatal(MYNAME ": Bad task route timestamp\n"); } @@ -729,7 +729,7 @@ static void wr_fix_record(const Waypoint* wpt, int pres_alt, int gnss_alt) const time_t tt = wpt->GetCreationTime().toTime_t(); tm = gmtime(&tt); - if (NULL == tm) { + if (nullptr == tm) { fatal(MYNAME ": bad track timestamp\n"); } @@ -819,8 +819,8 @@ static int correlate_tracks(const route_head* pres_track, const route_head* gnss */ static double interpolate_alt(const route_head* track, time_t time) { - static const queue* prev_elem = NULL; - static const queue* curr_elem = NULL; + static const queue* prev_elem = nullptr; + static const queue* curr_elem = nullptr; const Waypoint* prev_wpt; const Waypoint* curr_wpt; int time_diff; @@ -943,7 +943,7 @@ static arglist_t igc_args[] = { { "timeadj", &timeadj, "(integer sec or 'auto') Barograph to GPS time diff", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -957,7 +957,7 @@ ff_vecs_t igc_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, igc_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/ignrando.cc b/ignrando.cc index 0f1e70059..f469c25de 100644 --- a/ignrando.cc +++ b/ignrando.cc @@ -36,10 +36,10 @@ static int track_num; /* current index of track within track_disp_all */ static int xmlpoints; /* options */ -static char* index_opt = NULL; +static char* index_opt = nullptr; static arglist_t ignr_args[] = { - {"index", &index_opt, "Index of track to write (if more than one in source)", NULL, ARGTYPE_INT, "1", NULL , nullptr}, + {"index", &index_opt, "Index of track to write (if more than one in source)", nullptr, ARGTYPE_INT, "1", nullptr , nullptr}, ARG_TERMINATOR }; @@ -58,7 +58,7 @@ xg_tag_mapping ignr_xml_map[] = { { ignr_etape_end, cb_end, "/RANDONNEE/ETAPE" }, { ignr_etape_pos, cb_cdata, "/RANDONNEE/ETAPE/POSITION" }, { ignr_etape_alt, cb_cdata, "/RANDONNEE/ETAPE/ALTITUDE" }, - { NULL, (xg_cb_type)0, NULL } + { nullptr, (xg_cb_type)0, nullptr } }; static void @@ -78,7 +78,7 @@ static xg_callback ignr_etape_begin, ignr_etape_end; static void ignr_start(xg_string, const QXmlStreamAttributes*) { - ignr_xml_error((track != NULL)); + ignr_xml_error((track != nullptr)); track = route_head_alloc(); track_add_head(track); @@ -93,14 +93,14 @@ ignr_nb_etapes(xg_string args, const QXmlStreamAttributes*) static void ignr_descr(xg_string args, const QXmlStreamAttributes*) { - ignr_xml_error((track == NULL)); + ignr_xml_error((track == nullptr)); track->rte_desc = args; } static void ignr_etape_begin(xg_string, const QXmlStreamAttributes*) { - ignr_xml_error((wpt != NULL)); + ignr_xml_error((wpt != nullptr)); wpt = new Waypoint; } @@ -108,16 +108,16 @@ ignr_etape_begin(xg_string, const QXmlStreamAttributes*) static void ignr_etape_end(xg_string, const QXmlStreamAttributes*) { - ignr_xml_error((track == NULL) || (wpt == NULL)); + ignr_xml_error((track == nullptr) || (wpt == nullptr)); track_add_wpt(track, wpt); - wpt = NULL; + wpt = nullptr; } static void ignr_etape_pos(xg_string args, const QXmlStreamAttributes*) { - ignr_xml_error((wpt == NULL) || (args.isEmpty())); + ignr_xml_error((wpt == nullptr) || (args.isEmpty())); if (2 != sscanf(CSTRc(args), "%lf,%lf", &wpt->latitude, &wpt->longitude)) { fatal(MYNAME ": Invalid coordinates \"%s\"!\n", qPrintable(args)); @@ -127,8 +127,8 @@ ignr_etape_pos(xg_string args, const QXmlStreamAttributes*) static void ignr_etape_alt(xg_string args, const QXmlStreamAttributes*) { - ignr_xml_error((wpt == NULL)); - if (args == NULL) { + ignr_xml_error((wpt == nullptr)); + if (args == nullptr) { return; } @@ -142,9 +142,9 @@ ignr_etape_alt(xg_string args, const QXmlStreamAttributes*) static void ignr_rd_init(const QString& fname) { - xml_init(fname, ignr_xml_map, NULL); - wpt = NULL; - track = NULL; + xml_init(fname, ignr_xml_map, nullptr); + wpt = nullptr; + track = nullptr; } static void @@ -186,7 +186,7 @@ ignr_write_track_hdr(const route_head* track) gbfprintf(fout, "\t\n"); gbfprintf(fout, "\t\t%d\n", track->rte_waypt_ct); - if (track->rte_desc != NULL) { + if (track->rte_desc != nullptr) { gbfprintf(fout, "\t\t%s\n", CSTRc(track->rte_desc)); } gbfprintf(fout, "\t\n"); @@ -219,7 +219,7 @@ ignr_write() struct tm tm; char buff[32]; - if (index_opt != NULL) { + if (index_opt != nullptr) { track_index = atoi(index_opt); if ((track_index < 1) || (track_index > (int) track_count())) fatal(MYNAME ": Invalid track index %d (we have currently %d track(s))!\n", @@ -257,7 +257,7 @@ ff_vecs_t ignr_vecs = { ignr_rw_deinit, ignr_read, ignr_write, - NULL, + nullptr, ignr_args, CET_CHARSET_MS_ANSI, 1 , NULL_POS_OPS, diff --git a/igo8.cc b/igo8.cc index 024f829fe..c2d7e0127 100644 --- a/igo8.cc +++ b/igo8.cc @@ -95,9 +95,9 @@ static gbfile* igo8_file_in; static gbfile* igo8_file_out; // Options -static char* igo8_option_tracknum = NULL; -static char* igo8_option_title = NULL; -static char* igo8_option_description = NULL; +static char* igo8_option_tracknum = nullptr; +static char* igo8_option_title = nullptr; +static char* igo8_option_description = nullptr; // Internal state static uint32_t invented_time; @@ -106,9 +106,9 @@ static int in_point_count; // Exported options list static arglist_t igo8_options[] = { - { "tracknum", &igo8_option_tracknum, "Track identification number", NULL, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, - { "title", &igo8_option_title, "Track title", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, - { "description", &igo8_option_description, "Track description", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + { "tracknum", &igo8_option_tracknum, "Track identification number", nullptr, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, + { "title", &igo8_option_title, "Track title", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + { "description", &igo8_option_description, "Track description", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -350,7 +350,7 @@ void write_header() static void igo8_write() { write_header(); - track_disp_all(NULL, NULL, write_igo8_track_point); + track_disp_all(nullptr, nullptr, write_igo8_track_point); } // Callback definitions @@ -363,7 +363,7 @@ ff_vecs_t igo8_vecs = { igo8_write_deinit, igo8_read, igo8_write, - NULL, + nullptr, igo8_options, CET_CHARSET_UTF8, 1 diff --git a/ik3d.cc b/ik3d.cc index 7a7a822dd..a184345ae 100644 --- a/ik3d.cc +++ b/ik3d.cc @@ -50,7 +50,7 @@ xg_tag_mapping ikt_map[] = { { iktobj_waypt, cb_start, IKTOBJ "_*/GeoPosition" }, { iktobj_name, cb_cdata, IKTOBJ "_*/Name" }, { iktobj_text, cb_cdata, IKTOBJ "_*/POIDrawable2D/Text" }, - { NULL, (xg_cb_type)0, NULL } + { nullptr, (xg_cb_type)0, nullptr } }; static void @@ -67,8 +67,8 @@ ikt_object_end() name = QString(); text = QString(); - track = NULL; - waypt = NULL; + track = nullptr; + waypt = nullptr; } static void @@ -88,7 +88,7 @@ iktobj_trkpt(xg_string args, const QXmlStreamAttributes* attrv) waypt = new Waypoint; iktobj_waypt(args, attrv); track_add_wpt(track, waypt); - waypt = NULL; + waypt = nullptr; } static void @@ -122,10 +122,10 @@ iktobj_type(xg_string args, const QXmlStreamAttributes*) static void ikt_rd_init(const QString& fname) { - xml_init(fname, ikt_map, NULL); + xml_init(fname, ikt_map, nullptr); - track = NULL; - waypt = NULL; + track = nullptr; + waypt = nullptr; name = QString(); text = QString(); } @@ -151,12 +151,12 @@ ff_vecs_t ik3d_vecs = { ff_cap_none /* routes */ }, ikt_rd_init, - NULL, + nullptr, ikt_rd_deinit, - NULL, + nullptr, ikt_read, - NULL, - NULL, + nullptr, + nullptr, ikt_args, CET_CHARSET_UTF8, 1 , NULL_POS_OPS, diff --git a/inifile.cc b/inifile.cc index e5bc348a7..98cd51bb5 100644 --- a/inifile.cc +++ b/inifile.cc @@ -66,7 +66,7 @@ open_gpsbabel_inifile() { QString name; QString envstr; - gbfile* res = NULL; + gbfile* res = nullptr; envstr = ugetenv("GPSBABELINI"); if (!envstr.isNull()) { @@ -74,7 +74,7 @@ open_gpsbabel_inifile() return gbfopen(envstr, "r", "GPSBabel"); } warning("WARNING: GPSBabel-inifile, defined in environment, NOT found!\n"); - return NULL; + return nullptr; } name = find_gpsbabel_inifile(""); // Check in current directory first. if (name.isNull()) { @@ -104,7 +104,7 @@ static void inifile_load_file(gbfile* fin, inifile_t* inifile, const char* myname) { char* buf; - inifile_section_t* sec = NULL; + inifile_section_t* sec = nullptr; int line = 0; while ((buf = gbfgetstr(fin))) { @@ -125,11 +125,11 @@ inifile_load_file(gbfile* fin, inifile_t* inifile, const char* myname) char* cend = strchr(++cin, ']'); - if (cend != NULL) { + if (cend != nullptr) { *cend = '\0'; cin = lrtrim(cin); } - if ((*cin == '\0') || (cend == NULL)) { + if ((*cin == '\0') || (cend == nullptr)) { fatal("%s: invalid section header '%s' in '%s'.\n", myname, cin, qPrintable(gbinipathname)); } @@ -144,7 +144,7 @@ inifile_load_file(gbfile* fin, inifile_t* inifile, const char* myname) char* cx; inifile_entry_t* entry; - if (sec == NULL) { + if (sec == nullptr) { fatal("%s: missing section header in '%s'.\n", myname, qPrintable(gbinipathname)); } @@ -154,14 +154,14 @@ inifile_load_file(gbfile* fin, inifile_t* inifile, const char* myname) sec->ientries++; cx = strchr(cin, '='); - if (cx != NULL) { + if (cx != nullptr) { *cx = '\0'; cin = lrtrim(cin); } entry->key = xstrdup(cin); - if (cx != NULL) { + if (cx != nullptr) { cx = lrtrim(++cx); entry->val = xstrdup(cx); } else { @@ -176,8 +176,8 @@ inifile_find_value(const inifile_t* inifile, const char* sec_name, const char* k { queue* elem, *tmp; - if (inifile == NULL) { - return NULL; + if (inifile == nullptr) { + return nullptr; } QUEUE_FOR_EACH(&inifile->secs, elem, tmp) { @@ -195,7 +195,7 @@ inifile_find_value(const inifile_t* inifile, const char* sec_name, const char* k } } } - return NULL; + return nullptr; } /* public procedures */ @@ -211,12 +211,12 @@ inifile_t* inifile_init(const QString& filename, const char* myname) { inifile_t* result; - gbfile* fin = NULL; + gbfile* fin = nullptr; if (filename.isEmpty()) { fin = open_gpsbabel_inifile(); - if (fin == NULL) { - return NULL; + if (fin == nullptr) { + return nullptr; } } else { fin = gbfopen(filename, "rb", myname); @@ -233,7 +233,7 @@ inifile_init(const QString& filename, const char* myname) void inifile_done(inifile_t* inifile) { - if (inifile == NULL) { + if (inifile == nullptr) { return; } @@ -309,11 +309,11 @@ inifile_readint(const inifile_t* inifile, const char* section, const char* key, str = inifile_find_value(inifile, section, key); - if (str == NULL) { + if (str == nullptr) { return 0; } - if (value != NULL) { + if (value != nullptr) { *value = atoi(str); } return 1; diff --git a/internal_styles.cc b/internal_styles.cc index b0226327f..f879944cc 100644 --- a/internal_styles.cc +++ b/internal_styles.cc @@ -1489,7 +1489,7 @@ static char xmapwpt[] = "IFIELD IGNORE, \"\", \"%-.31s\"\n" "IFIELD DESCRIPTION, \"\", \"%-.78s\"\n" ; -style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap2006", xmap2006 } , { "xmap", xmap } , { "tomtom_itn_places", tomtom_itn_places } , { "tomtom_itn", tomtom_itn } , { "tomtom_asc", tomtom_asc } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "ricoh", ricoh } , { "openoffice", openoffice } , { "nima", nima } , { "navigonwpt", navigonwpt } , { "mxf", mxf } , { "motoactv", motoactv } , { "mapconverter", mapconverter } , { "mainnav", mainnav } , { "land_air_sea", land_air_sea } , { "kompass_wp", kompass_wp } , { "kompass_tk", kompass_tk } , { "igoprimo_poi", igoprimo_poi } , { "igo2008_poi", igo2008_poi } , { "iblue757", iblue757 } , { "iblue747", iblue747 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin_g1000", garmin_g1000 } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "flysight", flysight } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {0,0}}; +style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap2006", xmap2006 } , { "xmap", xmap } , { "tomtom_itn_places", tomtom_itn_places } , { "tomtom_itn", tomtom_itn } , { "tomtom_asc", tomtom_asc } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "ricoh", ricoh } , { "openoffice", openoffice } , { "nima", nima } , { "navigonwpt", navigonwpt } , { "mxf", mxf } , { "motoactv", motoactv } , { "mapconverter", mapconverter } , { "mainnav", mainnav } , { "land_air_sea", land_air_sea } , { "kompass_wp", kompass_wp } , { "kompass_tk", kompass_tk } , { "igoprimo_poi", igoprimo_poi } , { "igo2008_poi", igo2008_poi } , { "iblue757", iblue757 } , { "iblue747", iblue747 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin_g1000", garmin_g1000 } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "flysight", flysight } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } , {nullptr,nullptr}}; size_t nstyles = 39; #else /* CSVFMTS_ENABLED */ style_vecs_t style_list[] = {{0,0}}; diff --git a/interpolate.cc b/interpolate.cc index e63e1d17c..538c104b3 100644 --- a/interpolate.cc +++ b/interpolate.cc @@ -27,26 +27,26 @@ #if FILTERS_ENABLED #define MYNAME "Interpolate filter" -static char* opt_interval = NULL; +static char* opt_interval = nullptr; unsigned int interval = 0; -static char* opt_dist = NULL; +static char* opt_dist = nullptr; double dist = 0; -static char* opt_route = NULL; +static char* opt_route = nullptr; static arglist_t interpfilt_args[] = { { - "time", &opt_interval, "Time interval in seconds", NULL, + "time", &opt_interval, "Time interval in seconds", nullptr, ARGTYPE_BEGIN_EXCL | ARGTYPE_BEGIN_REQ | ARGTYPE_INT, - "0", NULL, nullptr + "0", nullptr, nullptr }, { "distance", &opt_dist, "Distance interval in miles or kilometers", - NULL, ARGTYPE_END_EXCL | ARGTYPE_END_REQ | ARGTYPE_STRING, + nullptr, ARGTYPE_END_EXCL | ARGTYPE_END_REQ | ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { - "route", &opt_route, "Interpolate routes instead", NULL, + "route", &opt_route, "Interpolate routes instead", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR @@ -55,7 +55,7 @@ arglist_t interpfilt_args[] = { void interpfilt_process() { - queue* backuproute = NULL; + queue* backuproute = nullptr; queue* elem, *tmp, *elem2, *tmp2; route_head* rte_new; int count = 0; @@ -197,8 +197,8 @@ interpfilt_init(const char*) filter_vecs_t interpolatefilt_vecs = { interpfilt_init, interpfilt_process, - NULL, - NULL, + nullptr, + nullptr, interpfilt_args }; #endif // FILTERS_ENABLED diff --git a/itracku.cc b/itracku.cc index ec6769c2b..64d34b25e 100644 --- a/itracku.cc +++ b/itracku.cc @@ -354,8 +354,8 @@ init_device() // select the type of option. static arglist_t itracku_args[] = { - { "backup", &backup_file_name, "Appends the input to a backup file", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, - { "new", &only_new, "Only waypoints that are not the backup file", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + { "backup", &backup_file_name, "Appends the input to a backup file", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, + { "new", &only_new, "Only waypoints that are not the backup file", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, // "default", ARGYTPE_STRING, ARG_NOMINMAX} , ARG_TERMINATOR }; @@ -369,12 +369,12 @@ itracku_rd_init_common(const QString&) { new_waypoint_count = 0; - if (backup_file_name != NULL) { + if (backup_file_name != nullptr) { fbackup = gbfopen(backup_file_name, "a+", MYNAME); backup_last_creation_time = itracku_file_read_last_time(fbackup); gbfseek(fbackup, 0, SEEK_END); } else { - fbackup = NULL; + fbackup = nullptr; backup_last_creation_time = 0; } } @@ -435,7 +435,7 @@ itracku_rd_ser_init(const QString& fname) port = xstrdup(qPrintable(fname)); dbg(1, "opening port %s", qPrintable(fname)); - if ((fd = gbser_init(port)) == NULL) { + if ((fd = gbser_init(port)) == nullptr) { fatal(MYNAME ": can't initialise port \"%s\"", port); } @@ -464,17 +464,17 @@ itracku_rd_deinit() if (fd) { dbg(3, "closing port %s", port); gbser_deinit(fd); - fd = NULL; + fd = nullptr; xfree(port); - port = NULL; + port = nullptr; } if (fin) { gbfclose(fin); - fin = NULL; + fin = nullptr; } if (fbackup) { gbfclose(fbackup); - fbackup = NULL; + fbackup = nullptr; } } @@ -494,7 +494,7 @@ import_data_record(itracku_data_record* d) gbfwrite(d, sizeof(*d), 1, fbackup); result = -1; } else { - result = (only_new == NULL); + result = (only_new == nullptr); } } else { result = -1; @@ -697,7 +697,7 @@ gprmc_parse(char* ibuf) &speed, &course, &dmy); if (rc == 0) { - return NULL; + return nullptr; } fsec = hms - (int)hms; @@ -776,16 +776,16 @@ ff_vecs_t itracku_vecs = { ff_cap_none /* routes */ }, itracku_rd_ser_init, - NULL, + nullptr, itracku_rd_deinit, - NULL, + nullptr, itracku_read, itracku_write, itracku_exit, itracku_args, CET_CHARSET_ASCII, 0, /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ - { itracku_rt_init, itracku_rt_position, itracku_rt_deinit, NULL, NULL, NULL }, + { itracku_rt_init, itracku_rt_position, itracku_rt_deinit, nullptr, nullptr, nullptr }, nullptr }; @@ -806,7 +806,7 @@ ff_vecs_t itracku_fvecs = { itracku_args, CET_CHARSET_ASCII, 0, /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ - { NULL, NULL, NULL, NULL, NULL, NULL }, + { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }, nullptr }; diff --git a/jeeps/gpsapp.cc b/jeeps/gpsapp.cc index 52a629809..ca81bb7c5 100644 --- a/jeeps/gpsapp.cc +++ b/jeeps/gpsapp.cc @@ -212,7 +212,7 @@ static int32 GPS_A000(const char* port) return gps_errno; } - GPS_Make_Packet(&tra, LINK_ID[0].Pid_Product_Rqst,NULL,0); + GPS_Make_Packet(&tra, LINK_ID[0].Pid_Product_Rqst,nullptr,0); if (!GPS_Write_Packet(fd,tra)) { return SERIAL_ERROR; } @@ -3935,7 +3935,7 @@ int32 GPS_A301_Get(const char* port, GPS_PTrack** trk, pcb_fn cb, int protoid) } /* Cheat and don't _really_ pass the trkpt back */ if (cb) { - cb(n, NULL); + cb(n, nullptr); } } @@ -4615,7 +4615,7 @@ void GPS_D311_Send(UC* data, GPS_PTrack trk, int32* len) UC* p; p = data; - GPS_Util_Put_Short(p,strtoul(trk->trk_ident, NULL, 0)); + GPS_Util_Put_Short(p,strtoul(trk->trk_ident, nullptr, 0)); p += 2; *len = p-data; @@ -6380,7 +6380,7 @@ int32 GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb) } /* Cheat and don't _really_ pass the trkpt back */ - cb(n, NULL); + cb(n, nullptr); } if (!GPS_Packet_Read(fd, &recpkt)) { @@ -6597,7 +6597,7 @@ int32 GPS_A1006_Get // Cheat and don't _really_ pass the crs back if (cb) { - cb(n, NULL); + cb(n, nullptr); } } @@ -6834,7 +6834,7 @@ int32 GPS_A1007_Get(const char* port, GPS_PCourse_Lap** clp, pcb_fn cb) /* Cheat and don't _really_ pass the trkpt back */ if (cb) { - cb(n, NULL); + cb(n, nullptr); } } @@ -7108,7 +7108,7 @@ int32 GPS_A1008_Get(const char* port, GPS_PCourse_Point** cpt, pcb_fn cb) /* Cheat and don't _really_ pass the trkpt back */ if (cb) { - cb(n, NULL); + cb(n, nullptr); } } @@ -7374,7 +7374,7 @@ void GPS_D1013_Get(GPS_PCourse_Limits limits, UC* p) const char* Get_Pkt_Type(US p, US d0, const char** xinfo) { - *xinfo = NULL; + *xinfo = nullptr; #define LT LINK_ID[gps_link_type] if (p == LT.Pid_Ack_Byte) { return "ACK"; diff --git a/jeeps/gpscom.cc b/jeeps/gpscom.cc index f485e5f22..6d20f3a48 100644 --- a/jeeps/gpscom.cc +++ b/jeeps/gpscom.cc @@ -266,13 +266,13 @@ int32 GPS_Command_Send_Track(const char* port, GPS_PTrack* trk, int32 n, int era ret = GPS_A300_Send(port, trk, n); break; case pA301: - ret = GPS_A301_Send(port, trk, n, 301, NULL); + ret = GPS_A301_Send(port, trk, n, 301, nullptr); break; case pA302: /* Units with A302 don't support track upload, so we convert the * track to a course on the fly and send that instead */ - ret = GPS_Command_Send_Track_As_Course(port, trk, n, NULL, 0, eraset); + ret = GPS_Command_Send_Track_As_Course(port, trk, n, nullptr, 0, eraset); break; default: GPS_Error("Send_Track: Unknown track protocol %d.", gps_trk_transfer); @@ -716,7 +716,7 @@ int32 GPS_Command_Get_Course switch (gps_course_lap_transfer) { case pA1007: - *n_clp = GPS_A1007_Get(port,clp, 0); + *n_clp = GPS_A1007_Get(port,clp, nullptr); break; default: GPS_Error("Get_Course: Unknown course lap protocol"); @@ -739,7 +739,7 @@ int32 GPS_Command_Get_Course switch (gps_course_point_transfer) { case pA1008: - *n_cpt = GPS_A1008_Get(port,cpt, 0); + *n_cpt = GPS_A1008_Get(port,cpt, nullptr); break; default: GPS_Error("Get_Course: Unknown course point protocol"); @@ -1087,7 +1087,7 @@ restart_tracks: if (!ctk[i]->ishdr) { continue; } - trk_idx = strtoul(ctk[i]->trk_ident, NULL, 0); + trk_idx = strtoul(ctk[i]->trk_ident, nullptr, 0); for (j=0; j<*n_crs; j++) if (crs[j]->track_index == trk_idx) { break; @@ -1153,10 +1153,10 @@ restart_course_points: int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32 n_trk, GPS_PWay* wpt, int32 n_wpt, int eraset) { - GPS_PCourse* crs = NULL; - GPS_PCourse_Lap* clp = NULL; - GPS_PTrack* ctk = NULL; - GPS_PCourse_Point* cpt = NULL; + GPS_PCourse* crs = nullptr; + GPS_PCourse_Lap* clp = nullptr; + GPS_PTrack* ctk = nullptr; + GPS_PCourse_Point* cpt = nullptr; int n_crs, n_clp=0, n_ctk=0, n_cpt=0; int i, j, trk_end, new_crs, first_new_ctk; int32 ret; @@ -1165,7 +1165,7 @@ int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32 if (eraset) { n_crs = 0; } else { - n_crs = GPS_Command_Get_Course(port, &crs, &clp, &ctk, &cpt, &n_clp, &n_ctk, &n_cpt, NULL); + n_crs = GPS_Command_Get_Course(port, &crs, &clp, &ctk, &cpt, &n_clp, &n_ctk, &n_cpt, nullptr); if (n_crs < 0) { return n_crs; } @@ -1252,7 +1252,7 @@ int32 GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32 /* Find closest track point */ for (j=first_new_ctk; jishdr) { - trk_idx = strtoul(ctk[j]->trk_ident, NULL, 0); + trk_idx = strtoul(ctk[j]->trk_ident, nullptr, 0); continue; } diff --git a/jeeps/gpsdatum.h b/jeeps/gpsdatum.h index 1e8502af2..c59f7977e 100644 --- a/jeeps/gpsdatum.h +++ b/jeeps/gpsdatum.h @@ -177,7 +177,7 @@ /* 123 */ { "CH-1903", 4, 674, 15, 405 }, /* 124 */ { "Palestine 1923", 27, -235, -85, 264 }, /* 125 */ { "ITM (Israeli New)", 21, -48, 55, -52 }, - { NULL, 0, 0, 0, 0 } + { nullptr, 0, 0, 0, 0 } }; @@ -217,7 +217,7 @@ { "WGS-84", 118 }, { "Israeli", 124 }, { "D_Israel_new", 125 }, - { NULL, -1 } + { nullptr, -1 } }; diff --git a/jeeps/gpsdevice.cc b/jeeps/gpsdevice.cc index 2b37d42a2..19fbd3205 100644 --- a/jeeps/gpsdevice.cc +++ b/jeeps/gpsdevice.cc @@ -25,7 +25,7 @@ extern gps_device_ops gps_serial_ops; extern gps_device_ops gps_usb_ops; -gps_device_ops* ops = NULL; +gps_device_ops* ops = nullptr; int32 GPS_Device_On(const char* port, gpsdevh** fd) { diff --git a/jeeps/gpslibusb.cc b/jeeps/gpslibusb.cc index 7379ac57a..04de63af9 100644 --- a/jeeps/gpslibusb.cc +++ b/jeeps/gpslibusb.cc @@ -87,7 +87,7 @@ static char** os_get_garmin_mountpoints() { // Hacked for testing. - return NULL; + return nullptr; } #elif __APPLE__ // In fantasy land, we'd query iokit for enumerated devices of the Garmin @@ -158,10 +158,10 @@ gusb_teardown(gpsdevh* dh) * when called via the atexit handler. That's not too * terrible. */ - if (NULL != dh) { + if (nullptr != dh) { xfree(dh); } - udev = NULL; + udev = nullptr; } return 0; } @@ -169,7 +169,7 @@ gusb_teardown(gpsdevh* dh) static void gusb_atexit_teardown(void) { - gusb_teardown(NULL); + gusb_teardown(nullptr); } @@ -427,7 +427,7 @@ int garmin_usb_scan(libusb_unit_data* lud, int req_unit_number) * may have a "dangling" packet that * needs to be drained. */ - gusb_close(NULL); + gusb_close(nullptr); } else if (req_unit_number == found_devices) { garmin_usb_start(dev, lud); } diff --git a/jeeps/gpsmem.cc b/jeeps/gpsmem.cc index 1066ee28a..14181104b 100644 --- a/jeeps/gpsmem.cc +++ b/jeeps/gpsmem.cc @@ -45,7 +45,7 @@ GPS_PPvt_Data GPS_Pvt_New(void) perror("malloc"); fprintf(stderr,"GPS_Pvt_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } return ret; @@ -86,7 +86,7 @@ GPS_PAlmanac GPS_Almanac_New(void) perror("malloc"); fprintf(stderr,"GPS_Almanac_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } ret->svid=0xff; @@ -131,7 +131,7 @@ GPS_PTrack GPS_Track_New(void) perror("malloc"); fprintf(stderr,"GPS_Track_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } return ret; @@ -173,7 +173,7 @@ GPS_PWay GPS_Way_New(void) perror("malloc"); fprintf(stderr,"GPS_Way_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } /* @@ -260,7 +260,7 @@ GPS_PLap GPS_Lap_New(void) perror("malloc"); fprintf(stderr,"GPS_Lap_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } return ret; @@ -299,7 +299,7 @@ GPS_PCourse GPS_Course_New(void) perror("malloc"); fprintf(stderr,"GPS_Course_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } return ret; @@ -337,7 +337,7 @@ GPS_PCourse_Lap GPS_Course_Lap_New(void) perror("malloc"); fprintf(stderr,"GPS_Course_Lap_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } return ret; @@ -376,7 +376,7 @@ GPS_PCourse_Point GPS_Course_Point_New(void) perror("malloc"); fprintf(stderr,"GPS_Course_Point_New: Insufficient memory"); fflush(stderr); - return NULL; + return nullptr; } return ret; diff --git a/jeeps/gpsserial.cc b/jeeps/gpsserial.cc index 8e245674c..783d3b3d2 100644 --- a/jeeps/gpsserial.cc +++ b/jeeps/gpsserial.cc @@ -522,7 +522,7 @@ int32 GPS_Serial_Chars_Ready(gpsdevh* dh) t.tv_sec = 0; t.tv_usec = 1000; - (void) select(fd+1,&rec,NULL,NULL,&t); + (void) select(fd+1,&rec,nullptr,nullptr,&t); if (FD_ISSET(fd,&rec)) { return 1; } @@ -555,7 +555,7 @@ int32 GPS_Serial_Wait(gpsdevh* dh) t.tv_sec = 0; t.tv_usec = 180000; /* Microseconds before GPS sends A001 */ - (void) select(psd->fd+1,&rec,NULL,NULL,&t); + (void) select(psd->fd+1,&rec,nullptr,nullptr,&t); if (FD_ISSET(psd->fd,&rec)) { return 1; } @@ -609,7 +609,7 @@ int32 GPS_Serial_Off(gpsdevh* dh) gps_errno = HARDWARE_ERROR; return 0; } - dh = NULL; + dh = nullptr; return 1; } diff --git a/jeeps/gpsusbcommon.cc b/jeeps/gpsusbcommon.cc index 14b7a0ac8..50ce4179f 100644 --- a/jeeps/gpsusbcommon.cc +++ b/jeeps/gpsusbcommon.cc @@ -124,7 +124,7 @@ top: m1 = Get_Pkt_Type(pkt_id, pkttype, &m2); if ((rv == 0) && (receive_state == rs_frombulk)) { m1= "RET2INTR"; - m2=NULL; + m2=nullptr; }; GPS_Diag("(%-8s%s)\n", m1, m2 ? m2 : ""); } diff --git a/jogmap.cc b/jogmap.cc index 37c821f6f..089a97abd 100644 --- a/jogmap.cc +++ b/jogmap.cc @@ -71,14 +71,14 @@ static xg_tag_mapping jogmap_map[] = { { jogmap_markers, cb_start, "/markers" }, { jogmap_marker, cb_start, "/markers/marker" }, - { NULL, (xg_cb_type)0, NULL } + { nullptr, (xg_cb_type)0, nullptr } }; static void jogmap_rd_init(const QString& fname) { - trk = NULL; - xml_init(fname, jogmap_map, NULL); + trk = nullptr; + xml_init(fname, jogmap_map, nullptr); } static void @@ -101,12 +101,12 @@ ff_vecs_t jogmap_vecs = { ff_cap_none }, /* routes */ jogmap_rd_init, - NULL, + nullptr, jogmap_rd_deinit, - NULL, + nullptr, jogmap_read, - NULL, - NULL, + nullptr, + nullptr, jogmap_args, CET_CHARSET_UTF8, 0 , NULL_POS_OPS, diff --git a/jtr.cc b/jtr.cc index ceba36db6..f4b7ad910 100644 --- a/jtr.cc +++ b/jtr.cc @@ -50,7 +50,7 @@ jtr_parse_time(const char* str, struct tm* tm, int* milli) hms = hms / 100; tm->tm_hour = hms % 100; - if ((*dot == '.') && (milli != NULL)) { + if ((*dot == '.') && (milli != nullptr)) { *milli = atoi(dot + 1) * 10; } @@ -99,7 +99,7 @@ jtr_read() { char* str; int line = 0; - route_head* trk = NULL; + route_head* trk = nullptr; while ((str = gbfgetstr(fin))) { Waypoint* wpt; @@ -133,7 +133,7 @@ jtr_read() column = -1; tmp = str; while ((str = csv_lineparse(tmp, ",", "", column++))) { - tmp = NULL; + tmp = nullptr; if (*str == '\0') { continue; @@ -239,7 +239,7 @@ jtr_read() WAYPT_SET(wpt, course, course); } - if (trk == NULL) { + if (trk == nullptr) { trk = route_head_alloc(); track_add_head(trk); } @@ -320,7 +320,7 @@ jtr_trkpt_disp_cb(const Waypoint* wpt) static void jtr_write() { - track_disp_all(NULL, NULL, jtr_trkpt_disp_cb); + track_disp_all(nullptr, nullptr, jtr_trkpt_disp_cb); } /**************************************************************************/ @@ -338,7 +338,7 @@ ff_vecs_t jtr_vecs = { jtr_wr_deinit, jtr_read, jtr_write, - NULL, + nullptr, jtr_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ diff --git a/kml.cc b/kml.cc index c591bcd89..b03f5c565 100644 --- a/kml.cc +++ b/kml.cc @@ -37,21 +37,21 @@ #include // options -static char* opt_deficon = NULL; -static char* opt_export_lines = NULL; -static char* opt_export_points = NULL; -static char* opt_export_track = NULL; -static char* opt_line_width = NULL; -static char* opt_line_color = NULL; -static char* opt_floating = NULL; -static char* opt_extrude = NULL; -static char* opt_trackdata = NULL; -static char* opt_trackdirection = NULL; -static char* opt_units = NULL; -static char* opt_labels = NULL; -static char* opt_max_position_points = NULL; -static char* opt_rotate_colors = NULL; -static char* opt_precision = NULL; +static char* opt_deficon = nullptr; +static char* opt_export_lines = nullptr; +static char* opt_export_points = nullptr; +static char* opt_export_track = nullptr; +static char* opt_line_width = nullptr; +static char* opt_line_color = nullptr; +static char* opt_floating = nullptr; +static char* opt_extrude = nullptr; +static char* opt_trackdata = nullptr; +static char* opt_trackdirection = nullptr; +static char* opt_units = nullptr; +static char* opt_labels = nullptr; +static char* opt_max_position_points = nullptr; +static char* opt_rotate_colors = nullptr; +static char* opt_precision = nullptr; static int export_lines; static int export_points; @@ -106,7 +106,7 @@ static const char kmt_power[] = "power"; static arglist_t kml_args[] = { - {"deficon", &opt_deficon, "Default icon name", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + {"deficon", &opt_deficon, "Default icon name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "lines", &opt_export_lines, "Export linestrings for tracks and routes", @@ -170,7 +170,7 @@ arglist_t kml_args[] = { { "rotate_colors", &opt_rotate_colors, "Rotate colors for tracks and routes (default automatic)", - NULL, ARGTYPE_FLOAT, "0", "360", nullptr + nullptr, ARGTYPE_FLOAT, "0", "360", nullptr }, { "prec", &opt_precision, @@ -277,7 +277,7 @@ xg_tag_mapping kml_map[] = { { gx_trk_e, cb_end, "/Placemark/*gx:Track" }, { gx_trk_when, cb_cdata, "/Placemark/*gx:Track/when" }, { gx_trk_coord, cb_cdata, "/Placemark/*gx:Track/gx:coord" }, - { NULL, (xg_cb_type) 0, NULL } + { nullptr, (xg_cb_type) 0, nullptr } }; static @@ -285,7 +285,7 @@ const char* kml_tags_to_ignore[] = { "kml", "Document", "Folder", - NULL, + nullptr, }; // The TimeSpan/begin and TimeSpan/end DateTimes: @@ -312,10 +312,10 @@ void wpt_e(xg_string, const QXmlStreamAttributes*) } if (wpt_tmp_queued) { waypt_add(wpt_tmp); - wpt_tmp = NULL; + wpt_tmp = nullptr; } else { delete wpt_tmp; - wpt_tmp = NULL; + wpt_tmp = nullptr; } wpt_tmp_queued = 0; } @@ -460,7 +460,7 @@ void gx_trk_e(xg_string, const QXmlStreamAttributes*) track_del_head(gx_trk_head); } delete gx_trk_times; - gx_trk_times = NULL; + gx_trk_times = nullptr; } void gx_trk_when(xg_string args, const QXmlStreamAttributes*) @@ -506,7 +506,7 @@ static void kml_rd_init(const QString& fname) { - xml_init(fname, kml_map, NULL); + xml_init(fname, kml_map, nullptr); xml_ignore_tags(kml_tags_to_ignore); } @@ -580,10 +580,10 @@ kml_wr_deinit() { writer->writeEndDocument(); delete writer; - writer = NULL; + writer = nullptr; oqfile->close(); delete oqfile; - oqfile = NULL; + oqfile = nullptr; if (!posnfilenametmp.isEmpty()) { #if __WIN32__ @@ -1184,7 +1184,7 @@ static const QString map_templates[] = { "Rand McNally", "Open Cycle Maps", "Open Street Maps", - NULL + nullptr }; @@ -1420,9 +1420,9 @@ static QString kml_geocache_get_logs(const Waypoint* wpt) QString r; fs_xml* fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX); - xml_tag* root = NULL; - xml_tag* curlog = NULL; - xml_tag* logpart = NULL; + xml_tag* root = nullptr; + xml_tag* curlog = nullptr; + xml_tag* logpart = nullptr; if (!fs_gpx) { return r; @@ -1453,8 +1453,8 @@ static QString kml_geocache_get_logs(const Waypoint* wpt) logpart = xml_findfirst(curlog, "groundspeak:text"); if (logpart) { - char* encstr = NULL; - char* t = NULL; + char* encstr = nullptr; + char* t = nullptr; int encoded = 0; encstr = xml_attribute(logpart, "encoded"); encoded = (toupper(encstr[0]) != 'F'); @@ -1888,7 +1888,7 @@ static void kml_mt_tlr(const route_head* header) static void kml_route_hdr(const route_head* header) { - kml_output_header(header, NULL); + kml_output_header(header, nullptr); } static void kml_route_disp(const Waypoint* waypointp) @@ -1913,10 +1913,10 @@ void kml_write_AbstractView() waypt_disp_all(kml_add_to_bounds); } if (track_waypt_count()) { - track_disp_all(NULL, NULL, kml_add_to_bounds); + track_disp_all(nullptr, nullptr, kml_add_to_bounds); } if (route_waypt_count()) { - route_disp_all(NULL, NULL, kml_add_to_bounds); + route_disp_all(nullptr, nullptr, kml_add_to_bounds); } writer->writeStartElement(QStringLiteral("LookAt")); @@ -2021,7 +2021,7 @@ void kml_write() // Style settings for bitmaps if (route_waypt_count()) { - kml_write_bitmap_style(kmlpt_route, ICON_RTE, NULL); + kml_write_bitmap_style(kmlpt_route, ICON_RTE, nullptr); } if (track_waypt_count()) { @@ -2031,14 +2031,14 @@ void kml_write() kml_write_bitmap_style(kmlpt_other, QString(ICON_DIR).arg(i), QString("track-%1").arg(i)); } } else { - kml_write_bitmap_style(kmlpt_track, ICON_TRK, NULL); + kml_write_bitmap_style(kmlpt_track, ICON_TRK, nullptr); } if (export_track) kml_write_bitmap_style(kmlpt_multitrack, ICON_MULTI_TRK, "track-none"); } - kml_write_bitmap_style(kmlpt_waypoint, ICON_WPT, NULL); + kml_write_bitmap_style(kmlpt_waypoint, ICON_WPT, nullptr); if (track_waypt_count() || route_waypt_count()) { writer->writeStartElement(QStringLiteral("Style")); @@ -2099,7 +2099,7 @@ void kml_write() kml_init_color_sequencer(track_count()); if (export_track) { - track_disp_all(kml_mt_hdr, kml_mt_tlr, NULL); + track_disp_all(kml_mt_hdr, kml_mt_tlr, nullptr); } track_disp_all(kml_track_hdr, kml_track_tlr, @@ -2145,7 +2145,7 @@ kml_get_posn_icon(int freshness) } -static route_head* posn_trk_head = NULL; +static route_head* posn_trk_head = nullptr; static void kml_wr_position(Waypoint* wpt) @@ -2230,8 +2230,8 @@ ff_vecs_t kml_vecs = { kml_wr_deinit, kml_read, kml_write, - NULL, + nullptr, kml_args, CET_CHARSET_UTF8, 1, /* CET-REVIEW */ - { NULL, NULL, NULL, kml_wr_position_init, kml_wr_position, kml_wr_position_deinit } + { nullptr, nullptr, nullptr, kml_wr_position_init, kml_wr_position, kml_wr_position_deinit } }; diff --git a/lmx.cc b/lmx.cc index bc72fc4b6..fc0ba90ef 100644 --- a/lmx.cc +++ b/lmx.cc @@ -35,7 +35,7 @@ static gbfile* ofd; static Waypoint* wpt_tmp; QString urllink; QString urllinkt; -static char* binary = NULL; +static char* binary = nullptr; #define MYNAME "lmx" @@ -44,7 +44,7 @@ arglist_t lmx_args[] = { { "binary", &binary, "Compact binary representation", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -141,7 +141,7 @@ lmx_stag(int tag) case 0x67: return "url"; default: - return 0; + return nullptr; } } @@ -312,13 +312,13 @@ static xg_tag_mapping gl_map[] = { { lmx_lm_link, cb_cdata, LM "/lm:mediaLink/lm:url" }, { lmx_lm_linkt, cb_cdata, LM "/lm:mediaLink/lm:name" }, { lmx_lm_mlink_e, cb_end, LM "/lm:mediaLink" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; static void lmx_rd_init(const QString& fname) { - xml_init(fname, gl_map, NULL); + xml_init(fname, gl_map, nullptr); } static void @@ -415,7 +415,7 @@ ff_vecs_t lmx_vecs = { lmx_wr_deinit, lmx_read, lmx_write, - NULL, + nullptr, lmx_args, CET_CHARSET_UTF8, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/lowranceusr.cc b/lowranceusr.cc index 307288b46..b312b8b6f 100644 --- a/lowranceusr.cc +++ b/lowranceusr.cc @@ -191,7 +191,7 @@ const lowranceusr_icon_mapping_t lowranceusr_icon_value_table[] = { { 10070, "Webcam Cache" }, // webcam { 10042, "Disabled Cache" }, // black box with red X - { -1, NULL } + { -1, nullptr } }; static gbfile* file_in; @@ -302,19 +302,19 @@ static arglist_t lowranceusr_args[] = { { "ignoreicons", &ignoreicons, "Ignore event marker icons on read", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "writeasicons", &writeasicons, "Treat waypoints as icons on write", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "merge", &merge, "(USR output) Merge into one segmented track", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "break", &seg_break, "(USR input) Break segments into separate tracks", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "wversion", &wversion_arg, "(USR output) Write version", @@ -1045,7 +1045,7 @@ data_write() if (NumRoutes) { lowrance_route_count=0; - route_disp_all(lowranceusr_route_hdr, NULL, lowranceusr_waypt_disp); + route_disp_all(lowranceusr_route_hdr, nullptr, lowranceusr_waypt_disp); } if (NumWaypoints && writeasicons) { @@ -1065,10 +1065,10 @@ data_write() trail_point_count = 0; trail_count = 0; /* count the number of total track points */ - track_disp_all(lowranceusr_merge_track_hdr, lowranceusr_merge_track_tlr, NULL); + track_disp_all(lowranceusr_merge_track_hdr, lowranceusr_merge_track_tlr, nullptr); /* write out the new track header */ trail_point_count = 0; - track_disp_all(lowranceusr_merge_track_hdr_2, NULL, lowranceusr_track_disp); + track_disp_all(lowranceusr_merge_track_hdr_2, nullptr, lowranceusr_track_disp); } else { @@ -1080,7 +1080,7 @@ data_write() if (NumTrails) { trail_count=0; - track_disp_all(lowranceusr_track_hdr, NULL, lowranceusr_track_disp); + track_disp_all(lowranceusr_track_hdr, nullptr, lowranceusr_track_disp); } } } @@ -1095,7 +1095,7 @@ ff_vecs_t lowranceusr_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, lowranceusr_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/lowranceusr4.cc b/lowranceusr4.cc index ba129192f..f1228e501 100644 --- a/lowranceusr4.cc +++ b/lowranceusr4.cc @@ -257,7 +257,7 @@ lowranceusr4_copy_fsdata(lowranceusr4_fsdata** dest, lowranceusr4_fsdata* src) { *dest = (lowranceusr4_fsdata*)xmalloc(sizeof(*src)); ** dest = *src; - (*dest)->fs.next = NULL; + (*dest)->fs.next = nullptr; } static void @@ -274,7 +274,7 @@ lowranceusr4_alloc_fsdata() fsdata->fs.type = FS_LOWRANCEUSR4; fsdata->fs.copy = (fs_copy) lowranceusr4_copy_fsdata; fsdata->fs.destroy = lowranceusr4_free_fsdata; - fsdata->fs.convert = NULL; + fsdata->fs.convert = nullptr; fsdata->uid_unit = 0; fsdata->uid_seq_low = 0; @@ -479,7 +479,7 @@ lowranceusr4_find_waypt(int uid_unit, int uid_seq_low, int uid_seq_high) #if !NEWQ queue* elem, *tmp; #endif - lowranceusr4_fsdata* fs = NULL; + lowranceusr4_fsdata* fs = nullptr; #if NEWQ // Iterate with waypt_disp_all? @@ -501,7 +501,7 @@ lowranceusr4_find_waypt(int uid_unit, int uid_seq_low, int uid_seq_high) printf(MYNAME " lowranceusr4_find_waypt: warning, failed finding waypoint with ids %d %d %d\n", uid_unit, uid_seq_low, uid_seq_high); } - return NULL; + return nullptr; } static void @@ -847,9 +847,9 @@ lowranceusr4_write_waypoints() also all routes */ waypt_table_sz = 0; waypt_table_ct = 0; - waypt_table = NULL; + waypt_table = nullptr; waypt_disp_all(register_waypt); - route_disp_all(NULL, NULL, register_waypt); + route_disp_all(nullptr, nullptr, register_waypt); if (global_opts.debug_level >= 1) { printf(MYNAME " writing %d waypoints\n", waypt_table_ct); @@ -1014,7 +1014,7 @@ lowranceusr4_write_trails() } gbfputint32(track_count(), file_out); track_uid = 0; - track_disp_all(lowranceusr4_write_track_hdr, NULL, lowranceusr4_write_track_waypt); + track_disp_all(lowranceusr4_write_track_hdr, nullptr, lowranceusr4_write_track_waypt); } static void @@ -1040,7 +1040,7 @@ data_write() lowranceusr4_writestr(opt_title, file_out, 1); /* date string */ - now = time(NULL); + now = time(nullptr); now_tm = gmtime(&now); sprintf(buf, "%d/%d/%d", now_tm->tm_mon+1, now_tm->tm_mday, now_tm->tm_year+1900); lowranceusr4_writestr(buf, file_out, 1); @@ -1074,7 +1074,7 @@ ff_vecs_t lowranceusr4_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, lowranceusr4_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/maggeo.cc b/maggeo.cc index b2bca8c63..980c6bd7a 100644 --- a/maggeo.cc +++ b/maggeo.cc @@ -35,7 +35,7 @@ static gbfile* maggeofile_in; static gbfile* maggeofile_out; -static short_handle desc_handle = NULL; +static short_handle desc_handle = nullptr; static QDateTime maggeo_parsedate(char* dmy); @@ -86,7 +86,7 @@ maggeo_read() while ((buff = gbfgetstr(maggeofile_in))) { Waypoint* wpt_tmp; geocache_data* gcdata; - char* s = NULL; + char* s = nullptr; int fld; buff = lrtrim(buff); @@ -104,7 +104,7 @@ maggeo_read() gcdata = wpt_tmp->AllocGCData(); while ((s = csv_lineparse(buff, ",", "", fld++))) { - buff = NULL; + buff = nullptr; s = lrtrim(s); if (*s == '\0') { @@ -241,7 +241,7 @@ maggeo_waypt_pr(const Waypoint* waypointp) double ilon, ilat; double lon, lat; int lon_deg, lat_deg; - const char* ctype = NULL; + const char* ctype = nullptr; QString placer; ilat = waypointp->latitude; @@ -332,8 +332,8 @@ ff_vecs_t maggeo_vecs = { maggeo_wr_deinit, maggeo_read, maggeo_write, - NULL, - NULL, + nullptr, + nullptr, #if FIRMWARE_DOES_88591 CET_CHARSET_LATIN1, 0 /* CET-REVIEW */ #else diff --git a/magproto.cc b/magproto.cc index fefddc252..b35a6957b 100644 --- a/magproto.cc +++ b/magproto.cc @@ -49,12 +49,12 @@ static void termwrite(char* obuf, int size); static void mag_readmsg(gpsdata_type objective); static void mag_handon(); static void mag_handoff(); -static short_handle mkshort_handle = NULL; -static char* deficon = NULL; -static char* bs = NULL; -static char* cmts = NULL; -static char* noack = NULL; -static char* nukewpt = NULL; +static short_handle mkshort_handle = nullptr; +static char* deficon = nullptr; +static char* bs = nullptr; +static char* cmts = nullptr; +static char* noack = nullptr; +static char* nukewpt = nullptr; static int route_out_count; static int waypoint_read_count; static int wpt_len = 8; @@ -142,7 +142,7 @@ static icon_mapping_t gps315_icon_table[] = { { "r", "food" }, { "s", "fuel" }, { "t", "tree" }, - { NULL, NULL } + { nullptr, nullptr } }; static icon_mapping_t map330_icon_table[] = { @@ -194,7 +194,7 @@ static icon_mapping_t map330_icon_table[] = { { "an", "Multi-Cache"}, /* Winery: grapes 'coz they "bunch" */ { "s", "Unknown Cache"}, /* 'Suprise' cache: use a target. */ { "ac", "Event Cache"}, /* Event caches. May be food. */ - { NULL, NULL } + { nullptr, nullptr } }; pid_to_model_t pid_to_model[] = { @@ -218,7 +218,7 @@ pid_to_model_t pid_to_model[] = { { mm_meridian, 46, "MobileMapper" }, { mm_meridian, 110, "Explorist 100" }, { mm_meridian, 111, "Explorist 200" }, - { mm_unknown, 0, NULL } + { mm_unknown, 0, nullptr } }; static icon_mapping_t* icon_mapping = map330_icon_table; @@ -473,7 +473,7 @@ retry: isz--; } isump = &ibuf[isz-1]; - isum = strtoul(isump, NULL,16); + isum = strtoul(isump, nullptr,16); if (isum != mag_pchecksum(&ibuf[1], isz-3)) { if (debug_serial) { warning("RXERR %02x/%02x: '%s'\n", isum, mag_pchecksum(&ibuf[1],isz-5), ibuf); @@ -487,7 +487,7 @@ retry: warning("READ: %s\n", ibuf); } if (IS_TKN("$PMGNCSM,")) { - last_rx_csum = strtoul(&ibuf[9], NULL, 16); + last_rx_csum = strtoul(&ibuf[9], nullptr, 16); magrxstate = mrs_handon; return; } @@ -523,7 +523,7 @@ retry: /* * Allow lazy allocation of track head. */ - if (trk_head == NULL) { + if (trk_head == nullptr) { /* These tracks don't have names, so derive one * from input filename. */ @@ -567,20 +567,20 @@ retry: } } -static void* serial_handle = NULL; +static void* serial_handle = nullptr; static int terminit(const QString& portname, int create_ok) { if (gbser_is_serial(qPrintable(portname))) { - if (serial_handle = gbser_init(qPrintable(portname)), NULL != serial_handle) { + if (serial_handle = gbser_init(qPrintable(portname)), nullptr != serial_handle) { int rc; if (rc = gbser_set_port(serial_handle, bitrate, 8, 0, 1), gbser_OK != rc) { fatal(MYNAME ": Can't configure port\n"); } } is_file = 0; - if (serial_handle == NULL) { + if (serial_handle == nullptr) { fatal(MYNAME ": Could not open serial port %s\n", qPrintable(portname)); } return 1; @@ -623,7 +623,7 @@ static void mag_dequote(char* ibuf) { - char* esc = NULL; + char* esc = nullptr; while ((esc = strchr(ibuf, 0x1b))) { int nremains = strlen(esc); @@ -672,10 +672,10 @@ static void termdeinit() { if (is_file) { gbfclose(magfile_h); - magfile_h = NULL; + magfile_h = nullptr; } else { gbser_deinit(serial_handle); - serial_handle = NULL; + serial_handle = nullptr; } } @@ -685,24 +685,24 @@ static void termdeinit() static arglist_t mag_sargs[] = { { - "deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING, - ARG_NOMINMAX, NULL + "deficon", &deficon, "Default icon name", nullptr, ARGTYPE_STRING, + ARG_NOMINMAX, nullptr }, { "maxcmts", &cmts, "Max number of comments to write (maxcmts=200)", - "200", ARGTYPE_INT, ARG_NOMINMAX, NULL + "200", ARGTYPE_INT, ARG_NOMINMAX, nullptr }, { "baud", &bs, "Numeric value of bitrate (baud=4800)", "4800", - ARGTYPE_INT, ARG_NOMINMAX, NULL + ARGTYPE_INT, ARG_NOMINMAX, nullptr }, { "noack", &noack, "Suppress use of handshaking in name of speed", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "nukewpt", &nukewpt, "Delete all waypoints", NULL, ARGTYPE_BOOL, - ARG_NOMINMAX, NULL + "nukewpt", &nukewpt, "Delete all waypoints", nullptr, ARGTYPE_BOOL, + ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -710,12 +710,12 @@ arglist_t mag_sargs[] = { static arglist_t mag_fargs[] = { { - "deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING, - ARG_NOMINMAX, NULL + "deficon", &deficon, "Default icon name", nullptr, ARGTYPE_STRING, + ARG_NOMINMAX, nullptr }, { "maxcmts", &cmts, "Max number of comments to write (maxcmts=200)", - NULL, ARGTYPE_INT, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -786,7 +786,7 @@ mag_rd_init_common(const QString& portname) const char** dlist = os_get_magellan_mountpoints(); explorist_info = explorist_ini_get(dlist); if (explorist_info) { - const char* vec_opts = NULL; + const char* vec_opts = nullptr; gpx_vec = find_vec("gpx", &vec_opts); } return; @@ -916,7 +916,7 @@ mag_deinit() waypt_flush(&rte_wpt_tmp); - trk_head = NULL; + trk_head = nullptr; curfname.clear(); } @@ -1061,7 +1061,7 @@ mag_rteparse(char* rtemsg) is_fatal(*ca++ != ',', MYNAME ": Incorrectly formatted route line '%s'", rtemsg); ce = strchr(ca, ','); - is_fatal(ce == NULL, MYNAME ": Incorrectly formatted route line '%s'", rtemsg); + is_fatal(ce == nullptr, MYNAME ": Incorrectly formatted route line '%s'", rtemsg); if (ca == ce) { rte_name = "Route"; @@ -1098,7 +1098,7 @@ mag_rteparse(char* rtemsg) } /* trim CRC from waypoint icon string */ - if ((p = strchr(abuf, '*')) != NULL) { + if ((p = strchr(abuf, '*')) != nullptr) { *p = '\0'; } @@ -1171,7 +1171,7 @@ mag_rteparse(char* rtemsg) QString mag_find_descr_from_token(const char* token) { - if (icon_mapping == NULL) { + if (icon_mapping == nullptr) { return "unknown"; } @@ -1191,7 +1191,7 @@ mag_find_token_from_descr(const QString& icon) { icon_mapping_t* i = icon_mapping; - if (i == NULL || icon == NULL) { + if (i == nullptr || icon == nullptr) { return "a"; } @@ -1440,11 +1440,11 @@ void mag_track_disp(const Waypoint* waypointp) int hms=0; int fracsec=0; int date=0; - struct tm* tm = NULL; + struct tm* tm = nullptr; ilat = waypointp->latitude; ilon = waypointp->longitude; - tm = NULL; + tm = nullptr; if (waypointp->creation_time.isValid()) { const time_t ct = waypointp->GetCreationTime().toTime_t(); tm = gmtime(&ct); @@ -1606,7 +1606,7 @@ const char** os_get_magellan_mountpoints() return dlist; #else fatal("Not implemented"); - return NULL; + return nullptr; #endif } @@ -1619,7 +1619,7 @@ os_gpx_files(const char* dirname) static glob_t g; char* path; xasprintf(&path, "%s/*.gpx", dirname); - glob(path, 0, NULL, &g); + glob(path, 0, nullptr, &g); xfree(path); return g.gl_pathv; #else @@ -1641,11 +1641,11 @@ ff_vecs_t mag_svecs = { mag_deinit, mag_read, mag_write, - NULL, + nullptr, mag_sargs, CET_CHARSET_ASCII, 0, /* CET-REVIEW */ NULL_POS_OPS, - NULL, + nullptr, }; ff_vecs_t mag_fvecs = { @@ -1657,11 +1657,11 @@ ff_vecs_t mag_fvecs = { mag_deinit, mag_read, mag_write, - NULL, + nullptr, mag_fargs, CET_CHARSET_ASCII, 0, /* CET-REVIEW */ NULL_POS_OPS, - NULL, + nullptr, }; /* @@ -1676,9 +1676,9 @@ ff_vecs_t magX_fvecs = { mag_wr_deinit, mag_read, mag_write, - NULL, + nullptr, mag_fargs, CET_CHARSET_ASCII, 0, /* CET-REVIEW */ NULL_POS_OPS, - NULL, + nullptr, }; diff --git a/main.cc b/main.cc index 4d40c4d6f..195df5047 100644 --- a/main.cc +++ b/main.cc @@ -100,9 +100,9 @@ load_args(const QString& filename, const QString& arg0) char* cbuff = xstrdup(CSTR(line)); char* cstr = csv_lineparse(cbuff, " ", "\"", 0); - while (cstr != NULL) { + while (cstr != nullptr) { qargs.append(QString::fromUtf8(cstr)); - cstr = csv_lineparse(NULL, " ", "\"", 0); + cstr = csv_lineparse(nullptr, " ", "\"", 0); } xfree(cbuff); @@ -202,14 +202,14 @@ main(int argc, char* argv[]) #endif int c; int argn; - ff_vecs_t* ivecs = NULL; - ff_vecs_t* ovecs = NULL; - filter_vecs_t* fvecs = NULL; + ff_vecs_t* ivecs = nullptr; + ff_vecs_t* ovecs = nullptr; + filter_vecs_t* fvecs = nullptr; QString fname; QString ofname; - const char* ivec_opts = NULL; - const char* ovec_opts = NULL; - const char* fvec_opts = NULL; + const char* ivec_opts = nullptr; + const char* ovec_opts = nullptr; + const char* fvec_opts = nullptr; int opt_version = 0; int did_something = 0; const char* prog_name = argv[0]; /* argv is modified during processing */ @@ -250,7 +250,7 @@ main(int argc, char* argv[]) // Note the documentation says to set LC_NUMERIC, but QCoreApplicationPrivate::initLocale() // actually sets LC_ALL. // Perhaps we should restore LC_ALL instead of only LC_NUMERIC. - if (strcmp(setlocale(LC_NUMERIC,0), "C") != 0) { + if (strcmp(setlocale(LC_NUMERIC,nullptr), "C") != 0) { #ifdef DEBUG_LOCALE printf("Resetting LC_NUMERIC\n"); #endif @@ -260,7 +260,7 @@ main(int argc, char* argv[]) #endif } /* reset LC_TIME for strftime */ - if (strcmp(setlocale(LC_TIME,0), "C") != 0) { + if (strcmp(setlocale(LC_TIME,nullptr), "C") != 0) { #ifdef DEBUG_LOCALE printf("Resetting LC_TIME\n"); #endif @@ -273,9 +273,9 @@ main(int argc, char* argv[]) global_opts.objective = wptdata; global_opts.masked_objective = NOTHINGMASK; /* this makes the default mask behaviour slightly different */ global_opts.charset_name.clear(); - global_opts.inifile = NULL; + global_opts.inifile = nullptr; - gpsbabel_now = time(NULL); /* gpsbabel startup-time */ + gpsbabel_now = time(nullptr); /* gpsbabel startup-time */ gpsbabel_time = current_time().toTime_t(); /* same like gpsbabel_now, but freezed to zero during testo */ #ifdef DEBUG_MEM @@ -346,17 +346,17 @@ main(int argc, char* argv[]) case 'i': optarg = FETCH_OPTARG; ivecs = find_vec(CSTR(optarg), &ivec_opts); - if (ivecs == NULL) { + if (ivecs == nullptr) { fatal("Input type '%s' not recognized\n", qPrintable(optarg)); } break; case 'o': - if (ivecs == NULL) { + if (ivecs == nullptr) { warning("-o appeared before -i. This is probably not what you want to do.\n"); } optarg = FETCH_OPTARG; ovecs = find_vec(CSTR(optarg), &ovec_opts); - if (ovecs == NULL) { + if (ovecs == nullptr) { fatal("Output type '%s' not recognized\n", qPrintable(optarg)); } break; @@ -366,10 +366,10 @@ main(int argc, char* argv[]) if (fname.isEmpty()) { fatal("No file or device name specified.\n"); } - if (ivecs == NULL) { + if (ivecs == nullptr) { fatal("No valid input type specified\n"); } - if (ivecs->rd_init == NULL) { + if (ivecs->rd_init == nullptr) { fatal("Format does not support reading.\n"); } if (global_opts.masked_objective & POSNDATAMASK) { @@ -388,7 +388,7 @@ main(int argc, char* argv[]) ivecs->read(); ivecs->rd_deinit(); - cet_convert_strings(global_opts.charset, NULL, NULL); + cet_convert_strings(global_opts.charset, nullptr, nullptr); cet_convert_deinit(); did_something = 1; @@ -404,7 +404,7 @@ main(int argc, char* argv[]) if (doing_nothing) { global_opts.masked_objective |= WPTDATAMASK; } - if (ovecs->wr_init == NULL) { + if (ovecs->wr_init == nullptr) { fatal("Format does not support writing.\n"); } @@ -413,7 +413,7 @@ main(int argc, char* argv[]) wpt_ct_bak = -1; rte_ct_bak = -1; trk_ct_bak = -1; - rte_head_bak = trk_head_bak = NULL; + rte_head_bak = trk_head_bak = nullptr; ovecs->wr_init(ofname); @@ -430,7 +430,7 @@ main(int argc, char* argv[]) route_backup(&rte_ct_bak, &rte_head_bak); track_backup(&trk_ct_bak, &trk_head_bak); - cet_convert_strings(NULL, global_opts.charset, NULL); + cet_convert_strings(nullptr, global_opts.charset, nullptr); global_opts.verbose_status = saved_status; } @@ -562,7 +562,7 @@ main(int argc, char* argv[]) optarg = FETCH_OPTARG; inifile_done(global_opts.inifile); if (optarg.isEmpty()) { /* from GUI to preserve inconsistent options */ - global_opts.inifile = NULL; + global_opts.inifile = nullptr; } else { global_opts.inifile = inifile_init(optarg, MYNAME); } @@ -612,21 +612,21 @@ main(int argc, char* argv[]) cet_convert_init(ivecs->encode, 1); start_session(ivecs->name, CSTR(qargs.at(0))); - if (ivecs->rd_init == NULL) { + if (ivecs->rd_init == nullptr) { fatal("Format does not support reading.\n"); } ivecs->rd_init(qargs.at(0)); ivecs->read(); ivecs->rd_deinit(); - cet_convert_strings(global_opts.charset, NULL, NULL); + cet_convert_strings(global_opts.charset, nullptr, nullptr); cet_convert_deinit(); if (qargs.size() == 2 && ovecs) { cet_convert_init(ovecs->encode, 1); - cet_convert_strings(NULL, global_opts.charset, NULL); + cet_convert_strings(nullptr, global_opts.charset, nullptr); - if (ovecs->wr_init == NULL) { + if (ovecs->wr_init == nullptr) { fatal("Format does not support writing.\n"); } @@ -640,7 +640,7 @@ main(int argc, char* argv[]) usage(prog_name,0); exit(0); } - if (ovecs == NULL) { + if (ovecs == nullptr) { /* * Push and pop verbose_status so we don't get dual * progress bars when doing characterset transformation. @@ -648,7 +648,7 @@ main(int argc, char* argv[]) int saved_status = global_opts.verbose_status; global_opts.verbose_status = 0; cet_convert_init(CET_CHARSET_ASCII, 1); - cet_convert_strings(NULL, global_opts.charset, NULL); + cet_convert_strings(nullptr, global_opts.charset, nullptr); waypt_disp_all(waypt_disp); global_opts.verbose_status = saved_status; } diff --git a/mapasia.cc b/mapasia.cc index 75fd58d28..b2cff6a18 100644 --- a/mapasia.cc +++ b/mapasia.cc @@ -69,9 +69,9 @@ tr7_rd_init(const QString& fname) static void tr7_read() { - route_head* trk = NULL; + route_head* trk = nullptr; unsigned int magic; - Waypoint* prev = NULL; + Waypoint* prev = nullptr; magic = gbfgetint32(fin); if (magic != TR7_TRACK_MAGIC) { @@ -90,7 +90,7 @@ tr7_read() lon = (double)le_read32(&buff[TR7_S_LON]) / 1000000.0; if ((fabs(lat) > 90) || (fabs(lon) > 180)) { /* that really happens */ - trk = NULL; + trk = nullptr; continue; } @@ -134,9 +134,9 @@ tr7_read() if (prev) { /* other track or bad timestamp */ if (wpt->creation_time.isValid() && (prev->creation_time.toTime_t() > wpt->creation_time.toTime_t())) { - trk = NULL; + trk = nullptr; } else if (waypt_distance(prev, wpt) > 9999.9) { - trk = NULL; + trk = nullptr; } } @@ -201,7 +201,7 @@ tr7_rd_deinit() static void tr7_disp_track_head_cb(const route_head*) { - wpt_tmp = NULL; + wpt_tmp = nullptr; } static void @@ -217,7 +217,7 @@ tr7_disp_waypt_cb(const Waypoint* wpt) if WAYPT_HAS(wpt, course) { course = wpt->course; - } else if (wpt_tmp != NULL) { + } else if (wpt_tmp != nullptr) { course = waypt_course(wpt_tmp, wpt); } else { course = -1; @@ -241,7 +241,7 @@ tr7_disp_waypt_cb(const Waypoint* wpt) if WAYPT_HAS(wpt, speed) { speed = wpt->speed; - } else if (wpt_tmp != NULL) { + } else if (wpt_tmp != nullptr) { speed = waypt_speed(wpt_tmp, wpt); } else { speed = -1; @@ -278,7 +278,7 @@ tr7_wr_deinit() static void tr7_write() { - track_disp_all(tr7_disp_track_head_cb, NULL, tr7_disp_waypt_cb); + track_disp_all(tr7_disp_track_head_cb, nullptr, tr7_disp_waypt_cb); } /**************************************************************************/ @@ -296,7 +296,7 @@ ff_vecs_t mapasia_tr7_vecs = { /* we can read and write tracks */ tr7_wr_deinit, tr7_read, tr7_write, - NULL, + nullptr, tr7_args, CET_CHARSET_UTF8, 1 /* FIXED - CET-REVIEW - */ , NULL_POS_OPS, diff --git a/mapbar_track.cc b/mapbar_track.cc index 34f796a55..08842e413 100644 --- a/mapbar_track.cc +++ b/mapbar_track.cc @@ -82,7 +82,7 @@ static void mapbar_track_read() { route_head* track = route_head_alloc(); - is_fatal((track == NULL), MYNAME ": memory non-enough"); + is_fatal((track == nullptr), MYNAME ": memory non-enough"); track_add_head(track); (void) read_datetime(); // start_time currently unused @@ -134,12 +134,12 @@ ff_vecs_t mapbar_track_vecs = { ff_type_file, { ff_cap_none, (ff_cap)(ff_cap_read), ff_cap_none }, mapbar_track_rd_init, - NULL, + nullptr, mapbar_track_rd_deinit, - NULL, + nullptr, mapbar_track_read, - NULL, - NULL, + nullptr, + nullptr, mapbar_track_args, CET_CHARSET_UTF8, 0 /* not fixed, can be changed through command line parameter */ diff --git a/mapfactor.cc b/mapfactor.cc index 58cdd5296..e7a104d96 100644 --- a/mapfactor.cc +++ b/mapfactor.cc @@ -42,7 +42,7 @@ geocache_container wpt_container(const QString&); void MapfactorRead() { - Waypoint* wpt = NULL; + Waypoint* wpt = nullptr; while (!reader.atEnd()) { QStringRef tag_name = reader.name(); @@ -117,10 +117,10 @@ mapfactor_wr_deinit() { writer->writeEndDocument(); delete writer; - writer = NULL; + writer = nullptr; oqfile->close(); delete oqfile; - oqfile = NULL; + oqfile = nullptr; } static void @@ -155,7 +155,7 @@ ff_vecs_t mapfactor_vecs = { mapfactor_wr_deinit, mapfactor_read, mapfactor_write, - NULL, + nullptr, mapfactor_args, CET_CHARSET_UTF8, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/mapsend.cc b/mapsend.cc index 03fed302b..639ec547e 100644 --- a/mapsend.cc +++ b/mapsend.cc @@ -36,7 +36,7 @@ static int trk_version = 30; #define MYNAME "mapsend" -static char* mapsend_opt_trkver = NULL; +static char* mapsend_opt_trkver = nullptr; #define MAPSEND_TRKVER_MIN 3 #define MAPSEND_TRKVER_MAX 4 @@ -555,7 +555,7 @@ ff_vecs_t mapsend_vecs = { mapsend_wr_deinit, mapsend_read, mapsend_wpt_write, - NULL, + nullptr, mapsend_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/mapsource.cc b/mapsource.cc index 65bb1f8b2..d2ecb031d 100644 --- a/mapsource.cc +++ b/mapsource.cc @@ -66,42 +66,42 @@ static short_handle read_route_wpt_mkshort_handle; #define MPSDESCBUFFERLEN 4096 -static char* snlen = NULL; -static char* snwhiteopt = NULL; -static char* mpsverout = NULL; -static char* mpsmergeouts = NULL; +static char* snlen = nullptr; +static char* snwhiteopt = nullptr; +static char* mpsverout = nullptr; +static char* mpsmergeouts = nullptr; static int mpsmergeout; -static char* mpsusedepth = NULL; -static char* mpsuseprox = NULL; +static char* mpsusedepth = nullptr; +static char* mpsuseprox = nullptr; static arglist_t mps_args[] = { { "snlen", &snlen, "Length of generated shortnames", "10", ARGTYPE_INT, "1", - NULL, NULL + nullptr, nullptr }, { "snwhite", &snwhiteopt, "Allow whitespace synth. shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "mpsverout", &mpsverout, - "Version of mapsource file to generate (3,4,5)", NULL, - ARGTYPE_INT, ARG_NOMINMAX, NULL + "Version of mapsource file to generate (3,4,5)", nullptr, + ARGTYPE_INT, ARG_NOMINMAX, nullptr }, { "mpsmergeout", &mpsmergeouts, "Merge output with existing file", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "mpsusedepth", &mpsusedepth, - "Use depth values on output (default is ignore)", NULL, - ARGTYPE_BOOL, ARG_NOMINMAX, NULL + "Use depth values on output (default is ignore)", nullptr, + ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "mpsuseprox", &mpsuseprox, "Use proximity values on output (default is ignore)", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -145,7 +145,7 @@ mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name) return waypointp; } } - return NULL; + return nullptr; } /* @@ -256,7 +256,7 @@ mps_wr_init(const QString& fname) if (mpsmergeout) { mps_file_out = gbfopen_le(fname, "rb", MYNAME); - if (mps_file_out == NULL) { + if (mps_file_out == nullptr) { mpsmergeout = 0; } else { gbfclose(mps_file_out); @@ -268,7 +268,7 @@ mps_wr_init(const QString& fname) /* yeah, yeah, so there's probably a library function for this */ tempname = QString("%1.%2").arg(fname).arg(rand(), 8, 16, QChar('0')); mps_file_temp = gbfopen_le(tempname, "rb", MYNAME); - if (mps_file_temp == NULL) { + if (mps_file_temp == nullptr) { break; } gbfclose(mps_file_temp); @@ -520,7 +520,7 @@ mps_waypoint_r(gbfile* mps_file, int mps_ver, Waypoint** wpt, unsigned int* mpsc int lon; int icon; - Waypoint* thisWaypoint = NULL; + Waypoint* thisWaypoint = nullptr; double mps_altitude = unknown_alt; double mps_proximity = unknown_alt; double mps_depth = unknown_alt; @@ -714,7 +714,7 @@ mps_waypoint_w(gbfile* mps_file, int mps_ver, const Waypoint* wpt, const int isR } gbfwrite(zbuf, 1, 1, mps_file); /* NULL termination */ xfree(ascii_description); - ascii_description = NULL; + ascii_description = nullptr; if (mps_proximity == unknown_alt) { gbfwrite(zbuf, 9, 1, mps_file); @@ -757,17 +757,17 @@ mps_waypoint_w(gbfile* mps_file, int mps_ver, const Waypoint* wpt, const int isR static void mps_waypoint_w_unique_wrapper(const Waypoint* wpt) { - Waypoint* wptfound = NULL; + Waypoint* wptfound = nullptr; /* Search for this waypoint in the ones already written */ wptfound = mps_find_wpt_q_by_name(&written_wpt_head, CSTRc(wpt->shortname)); /* is the next line necessary? Assumes we know who's called us and in what order */ - if (wptfound == NULL) { + if (wptfound == nullptr) { wptfound = mps_find_wpt_q_by_name(&written_route_wpt_head, CSTRc(wpt->shortname)); } /* if this waypoint hasn't been written then it is okay to do so */ - if (wptfound == NULL) { + if (wptfound == nullptr) { mps_waypoint_w(mps_file_out, mps_ver_out, wpt, (1==0)); /* ensure we record in our "private" queue what has been @@ -787,11 +787,11 @@ mps_waypoint_w_unique_wrapper(const Waypoint* wpt) static void mps_route_wpt_w_unique_wrapper(const Waypoint* wpt) { - Waypoint* wptfound = NULL; + Waypoint* wptfound = nullptr; /* Search for this waypoint in the ones already written */ wptfound = mps_find_wpt_q_by_name(&written_wpt_head, CSTRc(wpt->shortname)); - if (wptfound == NULL) + if (wptfound == nullptr) /* so, not a real wpt, so must check route wpts already written as reals */ { wptfound = mps_find_wpt_q_by_name(&written_route_wpt_head, CSTRc(wpt->shortname)); @@ -800,12 +800,12 @@ mps_route_wpt_w_unique_wrapper(const Waypoint* wpt) /* if this waypoint hasn't been written then it is okay to do so but assume it is only required for the route */ - if (wptfound == NULL) { + if (wptfound == nullptr) { /* Although we haven't written one out, this might still be a "real" waypoint If so, we need to write it out now accordingly */ wptfound = find_waypt_by_name(wpt->shortname); - if (wptfound == NULL) { + if (wptfound == nullptr) { /* well, we tried to find: it wasn't written and isn't a real waypoint */ mps_waypoint_w(mps_file_out, mps_ver_out, wpt, (1==1)); mps_wpt_q_add(&written_route_wpt_head, wpt); @@ -997,12 +997,12 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte) if found. With MapSource, one should consider the real waypoint list as definitive */ tempWpt = find_waypt_by_name(wptname); - if (tempWpt != NULL) { + if (tempWpt != nullptr) { thisWaypoint = new Waypoint(*tempWpt); } else { tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname); - if (tempWpt != NULL) { + if (tempWpt != nullptr) { thisWaypoint = new Waypoint(*tempWpt); } else { /* should never reach here, but we do need a fallback position */ @@ -1084,12 +1084,12 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte) */ tempWpt = find_waypt_by_name(wptname); - if (tempWpt != NULL) { + if (tempWpt != nullptr) { thisWaypoint = new Waypoint(*tempWpt); } else { tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname); - if (tempWpt != NULL) { + if (tempWpt != nullptr) { thisWaypoint = new Waypoint(*tempWpt); } else { /* should never reach here, but we do need a fallback position */ @@ -1136,7 +1136,7 @@ mps_routehdr_w(gbfile* mps_file, int mps_ver, const route_head* rte) queue* elem, *tmp; - prevRouteWpt = NULL; /* clear the stateful flag used to know when the start of route wpts happens */ + prevRouteWpt = nullptr; /* clear the stateful flag used to know when the start of route wpts happens */ memset(zbuf, 0, sizeof(zbuf)); @@ -1297,7 +1297,7 @@ mps_routedatapoint_w(gbfile* mps_file, int mps_ver, const Waypoint* rtewpt) memset(zbuf, 0, sizeof(zbuf)); memset(ffbuf, 0xff, sizeof(ffbuf)); - if (prevRouteWpt != NULL) { + if (prevRouteWpt != nullptr) { /* output the route link details */ reclen = 2; gbfputint32(reclen, mps_file); @@ -1406,7 +1406,7 @@ mps_routedatapoint_w(gbfile* mps_file, int mps_ver, const Waypoint* rtewpt) gbfwrite(zbuf, 1, 1, mps_file); /* NULL termination to ident */ wptfound = mps_find_wpt_q_by_name(&written_route_wpt_head, ident); - if (wptfound != NULL) { + if (wptfound != nullptr) { zbuf[0] = (char)MPSHIDDENROUTEWPTCLASS; } else { zbuf[0] = (char)MPSDEFAULTWPTCLASS; @@ -2097,9 +2097,9 @@ ff_vecs_t mps_vecs = { mps_wr_deinit, mps_read, mps_write, - NULL, + nullptr, mps_args, CET_CHARSET_MS_ANSI, 0, /* CET-REVIEW */ NULL_POS_OPS, - NULL, + nullptr, }; diff --git a/mkshort.cc b/mkshort.cc index 78ec64634..189abc216 100644 --- a/mkshort.cc +++ b/mkshort.cc @@ -64,7 +64,7 @@ static struct replacements { {"seven", "7"}, {"eight", "8"}, {"nine", "9"}, - {NULL, NULL} + {nullptr, nullptr} }; /* @@ -118,7 +118,7 @@ is_unique(mkshort_handle_imp* h, char* name) return z; } } - return (uniq_shortname*) NULL; + return (uniq_shortname*) nullptr; } static @@ -184,16 +184,16 @@ mkshort_del_handle(short_handle* h) } } /* setshort_badchars(*h, NULL); ! currently setshort_badchars() always allocates something ! */ - if (hdr->badchars != NULL) { + if (hdr->badchars != nullptr) { xfree(hdr->badchars); } - setshort_goodchars(*h, NULL); + setshort_goodchars(*h, nullptr); if (hdr->defname) { xfree(hdr->defname); } xfree(hdr); - *h = NULL; + *h = nullptr; } /* @@ -301,10 +301,10 @@ void setshort_defname(short_handle h, const char* s) { mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; - if (s == NULL) { + if (s == nullptr) { fatal("setshort_defname called without a valid name."); } - if (hdl->defname != NULL) { + if (hdl->defname != nullptr) { xfree(hdl->defname); } hdl->defname = xstrdup(s); @@ -320,7 +320,7 @@ setshort_badchars(short_handle h, const char* s) { mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; - if ((hdl->badchars != NULL)) { + if ((hdl->badchars != nullptr)) { xfree(hdl->badchars); } hdl->badchars = xstrdup(s ? s : DEFAULT_BADCHARS); @@ -335,13 +335,13 @@ setshort_goodchars(short_handle h, const char* s) { mkshort_handle_imp* hdl = (mkshort_handle_imp*) h; - if (hdl->goodchars != NULL) { + if (hdl->goodchars != nullptr) { xfree(hdl->goodchars); } - if (s != NULL) { + if (s != nullptr) { hdl->goodchars = xstrdup(s); } else { - hdl->goodchars = NULL; + hdl->goodchars = nullptr; } } diff --git a/mmo.cc b/mmo.cc index 9b3ae4f9c..985656981 100644 --- a/mmo.cc +++ b/mmo.cc @@ -43,7 +43,7 @@ arglist_t mmo_args[] = { ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "ver", &opt_version, "Write files with internal version [n]", NULL, + "ver", &opt_version, "Write files with internal version [n]", nullptr, ARGTYPE_INT, "17", "18", nullptr }, ARG_TERMINATOR @@ -118,7 +118,7 @@ static const mmo_icon_mapping_t mmo_icon_value_table[] = { { 0x16, "Yellow bouy" }, { 0x17, "Geocache" }, - { -1, NULL } + { -1, nullptr } }; static const uint32_t obj_type_ico = 0x00; @@ -353,7 +353,7 @@ mmo_end_of_route(mmo_data_t* data) if (rte->rte_waypt_ct == 0) { /* don't keep empty routes */ route_del_head(rte); - data->data = NULL; + data->data = nullptr; } } @@ -432,7 +432,7 @@ mmo_read_CObjWaypoint(mmo_data_t* data) Waypoint* wpt; time_t time; int rtelinks; - mmo_data_t** rtelink = NULL; + mmo_data_t** rtelink = nullptr; char* str; char buf[16]; int i, ux; @@ -489,7 +489,7 @@ mmo_read_CObjWaypoint(mmo_data_t* data) cx = lrtrim(str + 7); cend = strchr(cx, '\n'); - if (cend == NULL) { + if (cend == nullptr) { cend = cx + strlen(cx); } @@ -602,7 +602,7 @@ mmo_read_CObjRoute(mmo_data_t* data) mmo_fillbuf(buf, 7, 1); } route_del_head(rte); - data->data = NULL; + data->data = nullptr; return; } @@ -752,7 +752,7 @@ mmo_read_CObjTrack(mmo_data_t* data) if (trk->rte_waypt_ct == 0) { track_del_head(trk); - data->data = NULL; + data->data = nullptr; } } @@ -837,7 +837,7 @@ static mmo_data_t* mmo_read_object() { int objid; - mmo_data_t* data = NULL; + mmo_data_t* data = nullptr; // There are three cases: // a new object of a type that has not occurred previously in this file; @@ -886,7 +886,7 @@ mmo_read_object() DBG(("mmo_read_object", "objid = 0x%04X\n", objid)); if (objid & 0x8000) { - data = mmo_register_object(mmo_object_id++, NULL, (gpsdata_type)0); + data = mmo_register_object(mmo_object_id++, nullptr, (gpsdata_type)0); data->name = mmo_readstr(); if (objid != cat_object_id) { @@ -1018,7 +1018,7 @@ mmo_rd_init(const QString& fname) static void mmo_rd_deinit() { - route_disp_session(curr_session(), NULL, NULL, mmo_finalize_rtept_cb); + route_disp_session(curr_session(), nullptr, nullptr, mmo_finalize_rtept_cb); icons.clear(); @@ -1044,7 +1044,7 @@ mmo_read() DBG(("main", "loading file \"%s\".\n", fin->name)); - fx = gbfopen(NULL, "wb", MYNAME); + fx = gbfopen(nullptr, "wb", MYNAME); gbfcopyfrom(fx, fin, 0x7FFFFFFF); gbfrewind(fx); gbfclose(fin); @@ -1284,11 +1284,11 @@ mmo_write_wpt_cb(const Waypoint* wpt) } cx = wpt->notes; - if (cx == NULL) { + if (cx == nullptr) { cx = wpt->description; } - if (cx != NULL) { - char* kml = NULL; + if (cx != nullptr) { + char* kml = nullptr; if (strcmp(wpt->session->name, "kml") == 0) { utf_string tmp; @@ -1459,7 +1459,7 @@ mmo_wr_init(const QString& fname) opt_version++; } errno = 0; - mmo_version = strtol(opt_version, NULL, 0); + mmo_version = strtol(opt_version, nullptr, 0); if (errno || ((mmo_version != 0x11) && (mmo_version != 0x12))) { fatal(MYNAME ": Unsupported version identifier (%s)!\n", opt_version); } @@ -1491,8 +1491,8 @@ mmo_write() /* find out number of objects we have to write */ waypt_disp_all(mmo_enum_waypt_cb); - route_disp_all(mmo_enum_route_cb, NULL, mmo_enum_waypt_cb); - track_disp_all(mmo_enum_route_cb, NULL, NULL); + route_disp_all(mmo_enum_route_cb, nullptr, mmo_enum_waypt_cb); + track_disp_all(mmo_enum_route_cb, nullptr, nullptr); gbfputuint16(mmo_obj_ct, fout); @@ -1520,7 +1520,7 @@ ff_vecs_t mmo_vecs = { mmo_wr_deinit, mmo_read, mmo_write, - NULL, + nullptr, mmo_args, CET_CHARSET_MS_ANSI, 0 , NULL_POS_OPS, diff --git a/mtk_locus.cc b/mtk_locus.cc index d66561e65..dd583cd5b 100644 --- a/mtk_locus.cc +++ b/mtk_locus.cc @@ -72,12 +72,12 @@ ff_vecs_t mtk_locus_vecs = { ff_cap_none /* routes */ }, mtk_locus_rd_init, - NULL, // write init + nullptr, // write init mtk_locus_rd_deinit, - NULL, // write deinit + nullptr, // write deinit mtk_locus_read, - NULL, // write - NULL, // exit + nullptr, // write + nullptr, // exit mtk_locus_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ , NULL_POS_OPS, @@ -128,7 +128,7 @@ mtk_locus_rd_init(const QString& fname) dbg(1, "Input is a serial port\n"); read_mode = rm_serial; - if ((sfd = gbser_init(qPrintable(fname))) == NULL) { + if ((sfd = gbser_init(qPrintable(fname))) == nullptr) { fatal(MYNAME ": Can't initialise port \"%s\" (%s)\n", qPrintable(fname), strerror(errno)); } set_baudrate(); @@ -138,7 +138,7 @@ mtk_locus_rd_init(const QString& fname) dbg(1, "Input is a normal file\n"); read_mode = rm_file; - if ((ffd = gbfopen(fname, "rb", MYNAME)) == NULL) { + if ((ffd = gbfopen(fname, "rb", MYNAME)) == nullptr) { fatal(MYNAME ": Can't initialise port \"%s\" (%s)\n", qPrintable(fname), strerror(errno)); } } @@ -187,7 +187,7 @@ mtk_locus_read() } if (strcmp(opt_download, "1") == 0) { - send_command(PMTK_Q_LOCUS_DATA ",1", NULL); + send_command(PMTK_Q_LOCUS_DATA ",1", nullptr); while (! download_complete) { process_packet(); @@ -271,7 +271,7 @@ read_line() if (read_mode == rm_file) { s = gbfgetstr(ffd); - if (s == NULL) { + if (s == nullptr) { dbg(1, "EOF reached\n"); download_complete = 1; return; @@ -354,19 +354,19 @@ process_pmtklox() static Waypoint* waypt; token = strtok(line, ","); - if ((token == NULL) || (strcmp(token, "$PMTKLOX") != 0)) { + if ((token == nullptr) || (strcmp(token, "$PMTKLOX") != 0)) { warning("Line %i: Invalid packet id\n", packetnum); return; } - loxtype = strtok(NULL, ","); - if (loxtype == NULL) { + loxtype = strtok(nullptr, ","); + if (loxtype == nullptr) { warning("Line %i: Missing lox type\n", packetnum); return; } if (strcmp(loxtype, "0") == 0) { - last_loxsequence = atoi(strtok(NULL, "*")) - 1; + last_loxsequence = atoi(strtok(nullptr, "*")) - 1; dbg(1, "Line %i: last sequence will be %i\n", packetnum, last_loxsequence); return; } @@ -382,7 +382,7 @@ process_pmtklox() return; } - loxsequence = atoi(strtok(NULL, ",")); + loxsequence = atoi(strtok(nullptr, ",")); if (first_loxsequence == -1) { first_loxsequence = loxsequence; @@ -395,14 +395,14 @@ process_pmtklox() printf("Downloading packet %i of %i\r", loxsequence, last_loxsequence); } - token = strtok(NULL, ","); + token = strtok(nullptr, ","); fixnum = 0; - while (token != NULL) { + while (token != nullptr) { fixnum++; bytenum = 0; calculated_checksum = 0; for (wordnum=0; wordnum<4; wordnum++) { // 4 8-byte hex strings per fix - if (token == NULL) { + if (token == nullptr) { dbg(1, "Line %i: Fix %i incomplete data\n", packetnum, fixnum); return; } @@ -411,7 +411,7 @@ process_pmtklox() fixbytes[bytenum++] = hexval; calculated_checksum ^= hexval; } - token = strtok(NULL, ","); + token = strtok(nullptr, ","); } if (calculated_checksum != 0) { @@ -475,30 +475,30 @@ process_pmtklog() strtok(line, ","); - printf("Serial#: %s\n", strtok(NULL, ",")); + printf("Serial#: %s\n", strtok(nullptr, ",")); - type = atoi(strtok(NULL, ",")); + type = atoi(strtok(nullptr, ",")); if (type == 0) { printf("Type: %i (wrap around when full)\n", type); } else { printf("Type: %i (stop when full)\n", type); } - printf("Mode: 0x%02X\n", atoi(strtok(NULL, ","))); - printf("Content: %s\n", strtok(NULL, ",")); - printf("Interval: %s seconds\n", strtok(NULL, ",")); - printf("Distance: %s\n", strtok(NULL, ",")); - printf("Speed: %s\n", strtok(NULL, ",")); + printf("Mode: 0x%02X\n", atoi(strtok(nullptr, ","))); + printf("Content: %s\n", strtok(nullptr, ",")); + printf("Interval: %s seconds\n", strtok(nullptr, ",")); + printf("Distance: %s\n", strtok(nullptr, ",")); + printf("Speed: %s\n", strtok(nullptr, ",")); - status = atoi(strtok(NULL, ",")); + status = atoi(strtok(nullptr, ",")); if (status == 0) { printf("Status: %i (enabled)\n", status); } else { printf("Status: %i (disabled)\n", status); } - printf("Number: %s fixes available\n", strtok(NULL, ",")); - printf("Percent: %s%% used\n", strtok(NULL, ",")); + printf("Number: %s fixes available\n", strtok(nullptr, ",")); + printf("Percent: %s%% used\n", strtok(nullptr, ",")); } void @@ -508,8 +508,8 @@ process_pmtk001() char* flag; strtok(line, ","); - cmd = strtok(NULL,","); - flag = strtok(NULL,","); + cmd = strtok(nullptr,","); + flag = strtok(nullptr,","); switch (atoi(flag)) { case 0: @@ -536,7 +536,7 @@ process_pmtk705() char* token; token = strtok(line, ","); - token = strtok(NULL,","); + token = strtok(nullptr,","); printf("Firmware: %s\n", token); } @@ -565,7 +565,7 @@ send_command(const char* s, const char* wait_for) dbg(1, "Sent command: %s\n", cmd); - if (wait_for == NULL) { + if (wait_for == nullptr) { waiting_for[0] = '\0'; return; } diff --git a/mtk_logger.cc b/mtk_logger.cc index 632adf448..b329fad1b 100644 --- a/mtk_logger.cc +++ b/mtk_logger.cc @@ -183,7 +183,7 @@ struct log_type { { 17, 2, "RCR"}, { 18, 2, "MILLISECOND"}, { 19, 8, "DISTANCE" }, - { 20, 0, NULL}, + { 20, 0, nullptr}, }; struct sat_info { @@ -277,7 +277,7 @@ static arglist_t mtk_sargs[] = { }, { "csv", &csv_file, "MTK compatible CSV output file", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "block_size_kb", &OPT_block_size_kb, "Size of blocks in KB to request from device", @@ -363,7 +363,7 @@ static int do_cmd(const char* cmd, const char* expect, char** rslt, time_t timeo int rc; rc = gbser_read_line(fd, line, sizeof(line)-1, TIMEOUT, 0x0A, 0x0D); if (rc != gbser_OK) { - if (rc == gbser_TIMEOUT && time(NULL) > tout) { + if (rc == gbser_TIMEOUT && time(nullptr) > tout) { dbg(2, "NMEA command '%s' timeout !\n", cmd); return -1; // fatal(MYNAME "do_cmd(): Read error (%d)\n", rc); @@ -403,7 +403,7 @@ static int do_cmd(const char* cmd, const char* expect, char** rslt, time_t timeo int pAck; pType = &line[9]; pRslt = strchr(&line[9], ',') + 1; - if (memcmp(&cmd[5], pType, 3) == 0 && pRslt != NULL && *pRslt != '\0') { + if (memcmp(&cmd[5], pType, 3) == 0 && pRslt != nullptr && *pRslt != '\0') { pAck = *pRslt - '0'; if (pAck != 3 && pAck >= 0 && pAck < 4) { // Erase will return '2' dbg(1, "NMEA command '%s' failed - %s\n", cmd, MTK_ACK[pAck]); @@ -416,7 +416,7 @@ static int do_cmd(const char* cmd, const char* expect, char** rslt, time_t timeo } } - if (!done && time(NULL) > tout) { + if (!done && time(nullptr) > tout) { dbg(1, "NMEA command '%s' timeout !\n", cmd); return -1; } @@ -442,7 +442,7 @@ static void mtk_rd_init(const QString& fname) errno = 0; dbg(1, "Opening port %s...\n", port); - if ((fd = gbser_init(port)) == NULL) { + if ((fd = gbser_init(port)) == nullptr) { fatal(MYNAME ": Can't initialise port \"%s\" (%s)\n", port, strerror(errno)); } @@ -474,8 +474,8 @@ static void mtk_rd_init(const QString& fname) // say hello to GR245 to make it display "USB PROCESSING" if (strstr(model, "GR-245")) { holux245_init(); // remember we have a GR245 for mtk_rd_deinit() - rc |= do_cmd("$PHLX810*35\r\n", "PHLX852,", NULL, 10); - rc |= do_cmd("$PHLX826*30\r\n", "PHLX859*38", NULL, 10); + rc |= do_cmd("$PHLX810*35\r\n", "PHLX852,", nullptr, 10); + rc |= do_cmd("$PHLX826*30\r\n", "PHLX859*38", nullptr, 10); if (rc != 0) { dbg(2, "Greeting not successfull.\n"); } @@ -486,7 +486,7 @@ static void mtk_rd_init(const QString& fname) static void mtk_rd_deinit() { if (mtk_device == HOLUX_GR245) { - int rc = do_cmd("$PHLX827*31\r\n", "PHLX860*32", NULL, 10); + int rc = do_cmd("$PHLX827*31\r\n", "PHLX860*32", nullptr, 10); if (rc != 0) { dbg(2, "Goodbye not successfull.\n"); } @@ -494,14 +494,14 @@ static void mtk_rd_deinit() dbg(3, "Closing port...\n"); gbser_deinit(fd); - fd = NULL; + fd = nullptr; xfree(port); } static int mtk_erase() { int log_status, log_mask, err; - char* lstatus = NULL; + char* lstatus = nullptr; log_status = 0; // check log status - is logging disabled ? @@ -510,27 +510,27 @@ static int mtk_erase() log_status = atoi(lstatus); dbg(3, "LOG Status '%s'\n", lstatus); xfree(lstatus); - lstatus = NULL; + lstatus = nullptr; } do_cmd(CMD_LOG_FORMAT, "PMTK182,3,2,", &lstatus, 2); if (lstatus) { - log_mask = strtoul(lstatus, NULL, 16); + log_mask = strtoul(lstatus, nullptr, 16); dbg(3, "LOG Mask '%s' - 0x%.8x \n", lstatus, log_mask); xfree(lstatus); - lstatus = NULL; + lstatus = nullptr; } dbg(1, "Start flash erase..\n"); - do_cmd(CMD_LOG_DISABLE, "PMTK001,182,5,3", NULL, 1); + do_cmd(CMD_LOG_DISABLE, "PMTK001,182,5,3", nullptr, 1); gb_sleep(10*1000); // Erase log.... - do_cmd(CMD_LOG_ERASE, "PMTK001,182,6", NULL, 30); + do_cmd(CMD_LOG_ERASE, "PMTK001,182,6", nullptr, 30); gb_sleep(100*1000); if ((log_status & 2)) { // auto-log were enabled before..re-enable log. - err = do_cmd(CMD_LOG_ENABLE, "PMTK001,182,4,3", NULL, 2); + err = do_cmd(CMD_LOG_ENABLE, "PMTK001,182,4,3", nullptr, 2); dbg(3, "re-enable log %s\n", err==0?"Success":"Fail"); } return 0; @@ -539,14 +539,14 @@ static int mtk_erase() static void mtk_read() { char cmd[256]; - char* line = NULL; - unsigned char crc, *data = NULL; + char* line = nullptr; + unsigned char crc, *data = nullptr; int cmdLen, i, len, rc, init_scan, retry_cnt, log_enabled; unsigned int j, bsize, scan_bsize, read_bsize_kb, read_bsize, scan_step, ff_len, null_len, chunk_size; unsigned int line_size, data_size, data_addr, addr, addr_max, rcvd_addr, rcvd_bsize; unsigned long dsize, dpos = 0; FILE* dout; - char* fusage = NULL; + char* fusage = nullptr; if (*OPT_erase_only != '0') { @@ -557,9 +557,9 @@ static void mtk_read() log_enabled = 0; init_scan = 0; dout = ufopen(TEMP_DATA_BIN, "r+b"); - if (dout == NULL) { + if (dout == nullptr) { dout = ufopen(TEMP_DATA_BIN, "wb"); - if (dout == NULL) { + if (dout == nullptr) { fatal(MYNAME ": Can't create temporary file %s", qPrintable(TEMP_DATA_BIN)); return; @@ -581,12 +581,12 @@ static void mtk_read() log_enabled = (atoi(fusage) & 2)?1:0; dbg(3, "LOG Status '%s' -- log %s \n", fusage, log_enabled?"enabled":"disabled"); xfree(fusage); - fusage = NULL; + fusage = nullptr; } gb_sleep(10*1000); if (true || log_enabled) { - i = do_cmd(CMD_LOG_DISABLE, "PMTK001,182,5,3", NULL, 2); + i = do_cmd(CMD_LOG_DISABLE, "PMTK001,182,5,3", nullptr, 2); dbg(3, " ---- LOG DISABLE ---- %s\n", i==0?"Success":"Fail"); } gb_sleep(100*1000); @@ -595,7 +595,7 @@ static void mtk_read() // get flash usage, current log address..cmd only works if log disabled. do_cmd("$PMTK182,2,8*33\r\n", "PMTK182,3,8,", &fusage, 2); if (fusage) { - addr_max = strtoul(fusage, NULL, 16); + addr_max = strtoul(fusage, nullptr, 16); if (addr_max > 0) { addr_max = addr_max - addr_max%65536 + 65535; } @@ -615,7 +615,7 @@ static void mtk_read() init_scan = 0; QFile::rename(TEMP_DATA_BIN, TEMP_DATA_BIN_OLD); dout = ufopen(TEMP_DATA_BIN, "wb"); - if (dout == NULL) { + if (dout == nullptr) { fatal(MYNAME ": Can't create temporary file %s", qPrintable(TEMP_DATA_BIN)); return; @@ -624,7 +624,7 @@ static void mtk_read() scan_step = 0x10000; scan_bsize = 0x0400; - read_bsize_kb = strtol(OPT_block_size_kb, NULL, 10); + read_bsize_kb = strtol(OPT_block_size_kb, nullptr, 10); if (errno == ERANGE || read_bsize_kb < 1) { read_bsize_kb = 1; } else if (read_bsize_kb > 64) { @@ -641,10 +641,10 @@ static void mtk_read() line_size = 2*read_bsize + 32; // logdata as nmea/hex. data_size = read_bsize + 32; - if ((line = (char*) xmalloc(line_size)) == NULL) { + if ((line = (char*) xmalloc(line_size)) == nullptr) { fatal(MYNAME ": Can't allocate %u bytes for NMEA buffer\n", line_size); } - if ((data = (unsigned char*) xmalloc(data_size)) == NULL) { + if ((data = (unsigned char*) xmalloc(data_size)) == nullptr) { fatal(MYNAME ": Can't allocate %u bytes for data buffer\n", data_size); } memset(line, '\0', line_size); @@ -682,7 +682,7 @@ mtk_retry: line[len] = '\0'; if (strncmp(line, "$PMTK182,8", 10) == 0) { // $PMTK182,8,00005000,FFFFFFF retry_cnt = 0; - data_addr = strtoul(&line[11], NULL, 16); + data_addr = strtoul(&line[11], nullptr, 16); // fixme - we should check if all data before data_addr is already received i = 20; j = data_addr - addr; @@ -772,7 +772,7 @@ mtk_retry: } } } - if (dout != NULL) { + if (dout != nullptr) { #if __WIN32__ _chsize(fileno(dout), addr_max); #else @@ -786,15 +786,15 @@ mtk_retry: // Fixme - Order or. Enable - parse - erase ?? if (log_enabled || *OPT_log_enable=='1') { - i = do_cmd(CMD_LOG_ENABLE, "PMTK001,182,4,3", NULL, 2); + i = do_cmd(CMD_LOG_ENABLE, "PMTK001,182,4,3", nullptr, 2); dbg(3, " ---- LOG ENABLE ----%s\n", i==0?"Success":"Fail"); } else { dbg(1, "Note !!! -- Logging is DISABLED !\n"); } - if (line != NULL) { + if (line != nullptr) { xfree(line); } - if (data != NULL) { + if (data != nullptr) { xfree(data); } @@ -811,12 +811,12 @@ mtk_retry: } -static route_head* trk_head = NULL; +static route_head* trk_head = nullptr; static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm) { Waypoint* trk = new Waypoint; - if (global_opts.masked_objective& TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) { + if (global_opts.masked_objective& TRKDATAMASK && (trk_head == nullptr || (mtk_info.track_event & MTK_EVT_START))) { char spds[50]; trk_head = route_head_alloc(); trk_head->rte_name = QString("track-%1").arg(1 + track_count()); @@ -941,13 +941,13 @@ static void mtk_csv_init(char* csv_fname, unsigned long bitmask) dbg(1, "Opening csv output file %s...\n", csv_fname); // can't use gbfopen here - it will fatal() if file doesn't exist - if ((cf = ufopen(QString::fromUtf8(csv_fname), "r")) != NULL) { + if ((cf = ufopen(QString::fromUtf8(csv_fname), "r")) != nullptr) { fclose(cf); warning(MYNAME ": CSV file %s already exist ! Cowardly refusing to overwrite.\n", csv_fname); return; } - if ((cd = gbfopen(csv_fname, "w", MYNAME)) == NULL) { + if ((cd = gbfopen(csv_fname, "w", MYNAME)) == nullptr) { fatal(MYNAME ": Can't open csv file '%s'\n", csv_fname); } @@ -987,9 +987,9 @@ static void mtk_csv_init(char* csv_fname, unsigned long bitmask) static void mtk_csv_deinit() { - if (cd != NULL) { + if (cd != nullptr) { gbfclose(cd); - cd = NULL; + cd = nullptr; } } @@ -1312,7 +1312,7 @@ int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask) } else { dbg(1,"Missing '*' !\n"); if (data[i] == 0xff) { // in some case star-crc hasn't been written on power off. - dbg(1, "Bad data point @0x%.6x - skip %d bytes\n", (fl!=NULL)?ftell(fl):-1, i+2); + dbg(1, "Bad data point @0x%.6x - skip %d bytes\n", (fl!=nullptr)?ftell(fl):-1, i+2); return i+2; // include '*' and crc } } @@ -1325,12 +1325,12 @@ int mtk_parse(unsigned char* data, int dataLen, unsigned int bmask) } if (data[i] != crc) { - dbg(0,"%2d: Bad CRC %.2x != %.2x (pos 0x%.6x)\n", count, data[i], crc, (fl!=NULL)?ftell(fl):-1); + dbg(0,"%2d: Bad CRC %.2x != %.2x (pos 0x%.6x)\n", count, data[i], crc, (fl!=nullptr)?ftell(fl):-1); } i++; // crc count++; - if (cd != NULL) { + if (cd != nullptr) { csv_line(cd, count, bmask, &itm); } @@ -1474,7 +1474,7 @@ static void file_init_m241(const QString& fname) static void file_init(const QString& fname) { dbg(4, "Opening file %s...\n", qPrintable(fname)); - if (fl = ufopen(fname, "rb"), NULL == fl) { + if (fl = ufopen(fname, "rb"), nullptr == fl) { fatal(MYNAME ": Can't open file '%s'\n", qPrintable(fname)); } switch (mtk_device) { @@ -1685,12 +1685,12 @@ ff_vecs_t mtk_vecs = { ff_cap_none /* routes */ }, mtk_rd_init, - NULL, + nullptr, mtk_rd_deinit, - NULL, + nullptr, mtk_read, - NULL, - NULL, + nullptr, + nullptr, mtk_sargs, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ @@ -1706,12 +1706,12 @@ ff_vecs_t mtk_m241_vecs = { ff_cap_none /* routes */ }, mtk_rd_init_m241, - NULL, + nullptr, mtk_rd_deinit, - NULL, + nullptr, mtk_read, - NULL, - NULL, + nullptr, + nullptr, mtk_sargs, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ @@ -1724,7 +1724,7 @@ ff_vecs_t mtk_m241_vecs = { static arglist_t mtk_fargs[] = { { "csv", &csv_file, "MTK compatible CSV output file", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -1733,12 +1733,12 @@ ff_vecs_t mtk_fvecs = { ff_type_file, { ff_cap_read, ff_cap_read, ff_cap_none }, file_init, - NULL, + nullptr, file_deinit, - NULL, + nullptr, file_read, - NULL, - NULL, + nullptr, + nullptr, mtk_fargs, CET_CHARSET_UTF8, 1 /* master process: don't convert anything | CET-REVIEW */ , NULL_POS_OPS, @@ -1749,12 +1749,12 @@ ff_vecs_t mtk_m241_fvecs = { ff_type_file, { ff_cap_read, ff_cap_read, ff_cap_none }, file_init_m241, - NULL, + nullptr, file_deinit, - NULL, + nullptr, file_read, - NULL, - NULL, + nullptr, + nullptr, mtk_fargs, CET_CHARSET_UTF8, 1 /* master process: don't convert anything | CET-REVIEW */ , NULL_POS_OPS, diff --git a/mynav.cc b/mynav.cc index 969409b0c..6ff516365 100644 --- a/mynav.cc +++ b/mynav.cc @@ -158,13 +158,13 @@ ff_vecs_t mynav_vecs = { ff_cap_none // routes }, mynav_rd_init, // rd_init - NULL, // wr_init + nullptr, // wr_init mynav_rd_deinit, // rd_deinit - NULL, // wr_deinit + nullptr, // wr_deinit mynav_rd, // read - NULL, // write - NULL, // exit - NULL, //args + nullptr, // write + nullptr, // exit + nullptr, //args CET_CHARSET_ASCII, 0 //encode,fixed_encode //NULL //name dynamic/internal? , NULL_POS_OPS, diff --git a/navicache.cc b/navicache.cc index 4f72da47c..a7258a806 100644 --- a/navicache.cc +++ b/navicache.cc @@ -21,14 +21,14 @@ #include "src/core/file.h" #include -static char* noretired = NULL; +static char* noretired = nullptr; static QString read_fname; static arglist_t nav_args[] = { { "noretired", &noretired, "Suppress retired geocaches", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -232,7 +232,7 @@ ff_vecs_t navicache_vecs = { nav_wr_deinit, nav_read, nav_write, - NULL, + nullptr, nav_args, CET_CHARSET_UTF8, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/naviguide.cc b/naviguide.cc index 82103fb21..ef662fbde 100644 --- a/naviguide.cc +++ b/naviguide.cc @@ -78,8 +78,8 @@ static char strComment[101]; /* wp - process only waypoints */ /* rte - process as route */ /* wprte - Process waypoints and route */ -static char* process = NULL; -static char* reorder = NULL; +static char* process = nullptr; +static char* reorder = nullptr; static int process_rte = 1; static int reorder_wp = 0; @@ -293,7 +293,7 @@ data_write() nof_wp = route_waypt_count(); if (nof_wp) { header_write(); - route_disp_all(NULL, NULL, ng_waypt_rd); + route_disp_all(nullptr, nullptr, ng_waypt_rd); } } } @@ -304,7 +304,7 @@ wr_init(const QString& fname) { file_out = gbfopen_le(fname, "wb", MYNAME); ng_fill_header_default(); - if (NULL != reorder) + if (nullptr != reorder) if (!case_ignore_strcmp(reorder, "y")) { reorder_wp = 1; } @@ -326,7 +326,7 @@ rd_init(const QString& fname) ng_read_file_header(); - if (NULL != process) { + if (nullptr != process) { if (!case_ignore_strcmp(process, "wp")) { process_rte = 0; } @@ -342,7 +342,7 @@ static void rd_deinit() { gbfclose(file_in); - file_in = NULL; + file_in = nullptr; } @@ -420,7 +420,7 @@ ff_vecs_t ng_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, ng_args, CET_CHARSET_HEBREW, 0 , NULL_POS_OPS, diff --git a/navilink.cc b/navilink.cc index b05871016..177381bb9 100644 --- a/navilink.cc +++ b/navilink.cc @@ -29,15 +29,15 @@ #define MYNAME "NAVILINK" -static char* nuketrk = NULL; -static char* nukerte = NULL; -static char* nukewpt = NULL; -static char* nukedlg = NULL; -static char* poweroff = NULL; -static char* datalog = NULL; +static char* nuketrk = nullptr; +static char* nukerte = nullptr; +static char* nukewpt = nullptr; +static char* nukedlg = nullptr; +static char* poweroff = nullptr; +static char* datalog = nullptr; -static void* serial_handle = NULL; -static gbfile* file_handle = NULL; +static void* serial_handle = nullptr; +static gbfile* file_handle = nullptr; static unsigned char* track_data; static unsigned char* track_data_ptr; @@ -139,39 +139,39 @@ const char* const icon_table[] = { static arglist_t navilink_args[] = { { - "nuketrk", &nuketrk, "Delete all track points", NULL, ARGTYPE_BOOL, + "nuketrk", &nuketrk, "Delete all track points", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "nukerte", &nukerte, "Delete all routes", NULL, ARGTYPE_BOOL, + "nukerte", &nukerte, "Delete all routes", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "nukewpt", &nukewpt, "Delete all waypoints", NULL, ARGTYPE_BOOL, + "nukewpt", &nukewpt, "Delete all waypoints", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "nukedlg", &nukedlg, "Clear the datalog", NULL, ARGTYPE_BOOL, + "nukedlg", &nukedlg, "Clear the datalog", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "datalog", &datalog, "Read from datalogger buffer", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "power_off", &poweroff, "Command unit to power itself down", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; -static void (*write_waypoint)(const Waypoint*) = NULL; -static void (*write_track_start)(const route_head* track) = NULL; -static void (*write_track_point)(const Waypoint* waypt) = NULL; -static void (*write_track_end)(const route_head* track) = NULL; -static void (*write_route_start)(const route_head* track) = NULL; -static void (*write_route_point)(const Waypoint* waypt) = NULL; -static void (*write_route_end)(const route_head* track) = NULL; +static void (*write_waypoint)(const Waypoint*) = nullptr; +static void (*write_track_start)(const route_head* track) = nullptr; +static void (*write_track_point)(const Waypoint* waypt) = nullptr; +static void (*write_track_end)(const route_head* track) = nullptr; +static void (*write_route_start)(const route_head* track) = nullptr; +static void (*write_route_point)(const Waypoint* waypt) = nullptr; +static void (*write_route_end)(const route_head* track) = nullptr; static int find_icon_from_descr(const QString& descr) @@ -360,7 +360,7 @@ encode_datetime(time_t datetime, unsigned char* buffer) { struct tm* tm; - if ((tm = gmtime(&datetime)) != NULL) { + if ((tm = gmtime(&datetime)) != nullptr) { buffer[0] = tm->tm_year - 100; buffer[1] = tm->tm_mon + 1; buffer[2] = tm->tm_mday; @@ -470,7 +470,7 @@ encode_trackpoint(const Waypoint* waypt, unsigned serial, unsigned char* buffer) static Waypoint** serial_read_waypoints() { - Waypoint** waypts = NULL; + Waypoint** waypts = nullptr; unsigned char information[32]; unsigned short total; unsigned short start; @@ -479,7 +479,7 @@ serial_read_waypoints() waypts = (Waypoint**) xcalloc(MAX_WAYPOINTS, sizeof(Waypoint*)); } - write_packet(PID_QRY_INFORMATION, NULL, 0); + write_packet(PID_QRY_INFORMATION, nullptr, 0); read_packet(PID_DATA, information, sizeof(information), sizeof(information), FALSE); @@ -554,7 +554,7 @@ serial_read_track() unsigned short total; route_head* track; - write_packet(PID_QRY_INFORMATION, NULL, 0); + write_packet(PID_QRY_INFORMATION, nullptr, 0); read_packet(PID_DATA, information, sizeof(information), sizeof(information), FALSE); @@ -580,7 +580,7 @@ serial_read_track() trackpoints = (unsigned char*) xmalloc(count * 32); read_packet(PID_DATA, trackpoints, count * 32, count * 32, FALSE); - write_packet(PID_ACK, NULL, 0); + write_packet(PID_ACK, nullptr, 0); for (t = trackpoints; t < trackpoints + count * 32; t = t + 32) { track_add_wpt(track, decode_trackpoint(t)); @@ -601,7 +601,7 @@ serial_write_track() unsigned short total; unsigned char data[7]; - write_packet(PID_QRY_INFORMATION, NULL, 0); + write_packet(PID_QRY_INFORMATION, nullptr, 0); read_packet(PID_DATA, information, sizeof(information), sizeof(information), FALSE); @@ -616,7 +616,7 @@ serial_write_track() write_packet(PID_WRITE_TRACKPOINTS, data, sizeof(data)); gb_sleep(10000); write_packet(PID_DATA, track_data, track_data_ptr - track_data); - read_packet(PID_CMD_OK, NULL, 0, 0, FALSE); + read_packet(PID_CMD_OK, nullptr, 0, 0, FALSE); track_data_ptr = track_data; } @@ -658,7 +658,7 @@ serial_read_routes(Waypoint** waypts) unsigned char routec; unsigned char r; - write_packet(PID_QRY_INFORMATION, NULL, 0); + write_packet(PID_QRY_INFORMATION, nullptr, 0); read_packet(PID_DATA, information, sizeof(information), sizeof(information), FALSE); @@ -694,7 +694,7 @@ serial_read_routes(Waypoint** waypts) sr = MAX_SUBROUTES; } else if (id >= MAX_WAYPOINTS) { fatal(MYNAME ": Invalid waypoint ID in route\n"); - } else if (waypts[id] == NULL) { + } else if (waypts[id] == nullptr) { fatal(MYNAME ": Non-existent waypoint in route\n"); } else { route_add_wpt(route, new Waypoint(*waypts[id])); @@ -740,7 +740,7 @@ serial_write_route_end(const route_head* route) QString rte_name; rte_name = route->rte_name; - if (rte_name == NULL) { + if (rte_name == nullptr) { rte_name = "NO NAME"; } if (route_id_ptr > MAX_ROUTE_LENGTH) { @@ -842,7 +842,7 @@ decode_sbp_position(const unsigned char* buffer, Waypoint* waypt) Waypoint* navilink_decode_logpoint(const unsigned char* buffer) { - Waypoint* waypt = NULL; + Waypoint* waypt = nullptr; waypt = new Waypoint; waypt->hdop = ((unsigned char)buffer[0]) * 0.2f; @@ -873,7 +873,7 @@ read_datalog_info(unsigned int* seg1_addr, unsigned int* seg1_len, unsigned int data_start_addr; unsigned int next_blank_addr; - write_packet(PID_INFO_DATALOG, NULL, 0); + write_packet(PID_INFO_DATALOG, nullptr, 0); read_packet(PID_DATA, info, sizeof(info), sizeof(info), FALSE); flash_start_addr = le_read32(info); @@ -921,7 +921,7 @@ read_datalog_records(route_head* track, write_packet(PID_READ_DATALOG, payload, sizeof(payload)); read_packet(PID_DATA, logpoints, logpoints_len, logpoints_len, FALSE); - write_packet(PID_ACK, NULL, 0); + write_packet(PID_ACK, nullptr, 0); for (p = logpoints; p < logpoints + logpoints_len; p += 32) { track_add_wpt(track, navilink_decode_logpoint(p)); @@ -959,7 +959,7 @@ static void file_read() { unsigned char data[32]; - route_head* track = NULL; + route_head* track = nullptr; while (gbfread(data, sizeof(data), 1, file_handle) == 1) { switch (le_read16(data)) { @@ -976,7 +976,7 @@ file_read() break; default: if (global_opts.masked_objective & TRKDATAMASK) { - if (track == NULL) { + if (track == nullptr) { track = route_head_alloc(); track_add_head(track); } @@ -1040,7 +1040,7 @@ nuke() unsigned char information[32]; unsigned char data[7]; - write_packet(PID_QRY_INFORMATION, NULL, 0); + write_packet(PID_QRY_INFORMATION, nullptr, 0); read_packet(PID_DATA, information, sizeof(information), sizeof(information), FALSE); @@ -1050,7 +1050,7 @@ nuke() data[6] = 0; write_packet(PID_ERASE_TRACK, data, sizeof(data)); - read_packet(PID_CMD_OK, NULL, 0, 0, FALSE); + read_packet(PID_CMD_OK, nullptr, 0, 0, FALSE); } if (nukerte) { @@ -1058,7 +1058,7 @@ nuke() le_write32(data, 0x00f00000); write_packet(PID_DEL_ALL_ROUTE, data, sizeof(data)); - if (!read_packet(PID_ACK, NULL, 0, 0, TRUE)) { + if (!read_packet(PID_ACK, nullptr, 0, 0, TRUE)) { fatal(MYNAME ": Could not nuke all routes.\n"); } } @@ -1068,7 +1068,7 @@ nuke() le_write32(data, 0x00f00000); write_packet(PID_DEL_ALL_WAYPOINT, data, sizeof(data)); - if (!read_packet(PID_ACK, NULL, 0, 0, TRUE)) { + if (!read_packet(PID_ACK, nullptr, 0, 0, TRUE)) { fatal(MYNAME ": You must nuke all routes before nuking waypoints.\n"); /* perhaps a better action would be to nuke routes for user. * i.e. set nukerte when nukewpt is set */ @@ -1076,13 +1076,13 @@ nuke() } if (nukedlg) { - write_packet(PID_CLEAR_DATALOG, NULL, 0); + write_packet(PID_CLEAR_DATALOG, nullptr, 0); /* The flash erase operation is time-consuming. Each sector (64KB) * takes around 1 second. The total sectors for SBP is 10. * So give the device some time to clear its datalog, in addition * to SERIAL_TIMEOUT, which applies to read_packet() */ gb_sleep(CLEAR_DATALOG_TIME * 1000); - read_packet(PID_ACK, NULL, 0, 0, FALSE); + read_packet(PID_ACK, nullptr, 0, 0, FALSE); } } @@ -1090,7 +1090,7 @@ static void navilink_common_init(const QString& name) { if (gbser_is_serial(qPrintable(name))) { - if ((serial_handle = gbser_init(qPrintable(name))) == NULL) { + if ((serial_handle = gbser_init(qPrintable(name))) == nullptr) { fatal(MYNAME ": Could not open serial port %s\n", qPrintable(name)); } @@ -1098,8 +1098,8 @@ navilink_common_init(const QString& name) fatal(MYNAME ": Can't configure port\n"); } - write_packet(PID_SYNC, NULL, 0); - read_packet(PID_ACK, NULL, 0, 0, FALSE); + write_packet(PID_SYNC, nullptr, 0); + read_packet(PID_ACK, nullptr, 0, 0, FALSE); /* nuke data before writing */ if (operation == WRITING) { @@ -1153,7 +1153,7 @@ navilink_deinit() } if (poweroff) { - write_packet(PID_QUIT, NULL, 0); + write_packet(PID_QUIT, nullptr, 0); } gbser_deinit(serial_handle); @@ -1179,7 +1179,7 @@ navilink_read() } } else { if (serial_handle) { - Waypoint** waypts = NULL; + Waypoint** waypts = nullptr; if (global_opts.masked_objective & (WPTDATAMASK|RTEDATAMASK)) { waypts = serial_read_waypoints(); @@ -1227,7 +1227,7 @@ navilink_write() write_route_point); if (route_waypts) { free_waypoints(route_waypts); - route_waypts = NULL; + route_waypts = nullptr; } break; default: @@ -1244,7 +1244,7 @@ ff_vecs_t navilink_vecs = { navilink_deinit, navilink_read, navilink_write, - NULL, + nullptr, navilink_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/navitel.cc b/navitel.cc index 8ffb70f3a..6b88c3e10 100644 --- a/navitel.cc +++ b/navitel.cc @@ -49,7 +49,7 @@ static void navitel_read_track() { int points, i; - route_head* trk = NULL; + route_head* trk = nullptr; points = gbfgetint32(fin); (void) gbfgetint32(fin); /* unknown */ @@ -65,7 +65,7 @@ navitel_read_track() wpt->latitude = GPS_Math_Semi_To_Deg(lat & 0x7FFFFFFF); wpt->longitude = GPS_Math_Semi_To_Deg(lon); - if ((lat >> 31) || (trk == NULL)) { + if ((lat >> 31) || (trk == nullptr)) { trk = route_head_alloc(); track_add_head(trk); } @@ -118,7 +118,7 @@ static void navitel_write_track() { trkpts = 0; - track_disp_all(NULL, NULL, navitel_enum_trkpts); + track_disp_all(nullptr, nullptr, navitel_enum_trkpts); if (trkpts > 10000) { trkpts = 10000; warning(MYNAME ": Can store only 10000 points per file!\n"); @@ -126,7 +126,7 @@ navitel_write_track() gbfputint32(trkpts, fout); gbfputint32(1, fout); /* ? */ - track_disp_all(navitel_disp_trk_head, NULL, navitel_disp_trkpts); + track_disp_all(navitel_disp_trk_head, nullptr, navitel_disp_trkpts); } /**************************************************************************/ @@ -144,8 +144,8 @@ ff_vecs_t navitel_trk_vecs = { navitel_wr_deinit, navitel_read_track, navitel_write_track, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_UTF8, 1 /* Nothing to convert */ , NULL_POS_OPS, nullptr diff --git a/netstumbler.cc b/netstumbler.cc index 804204010..e6efac17c 100644 --- a/netstumbler.cc +++ b/netstumbler.cc @@ -28,11 +28,11 @@ #include static gbfile* file_in; -static char* nseicon = NULL; -static char* nsneicon = NULL; -static char* seicon = NULL; -static char* sneicon = NULL; -static char* snmac = NULL; +static char* nseicon = nullptr; +static char* nsneicon = nullptr; +static char* seicon = nullptr; +static char* sneicon = nullptr; +static char* snmac = nullptr; static int macstumbler; static void fix_netstumbler_dupes(); @@ -58,7 +58,7 @@ arglist_t netstumbler_args[] = { "Green Diamond", ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { - "snmac", &snmac, "Shortname is MAC address", NULL, ARGTYPE_BOOL, + "snmac", &snmac, "Shortname is MAC address", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR @@ -184,7 +184,7 @@ data_read() break; case 8: /* flags */ - flags = strtol(field, NULL, 16); + flags = strtol(field, nullptr, 16); break; case 11: /* data rate */ @@ -205,7 +205,7 @@ data_read() } field_num++; - field = csv_lineparse(NULL, "\t", "", line_no); + field = csv_lineparse(nullptr, "\t", "", line_no); } if (lat == 0 && lon == 0) { /* skip records with no GPS data */ @@ -338,12 +338,12 @@ ff_vecs_t netstumbler_vecs = { ff_type_file, { ff_cap_read, ff_cap_none, ff_cap_none }, rd_init, - NULL, + nullptr, rd_deinit, - NULL, + nullptr, data_read, - NULL, - NULL, + nullptr, + nullptr, netstumbler_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/nmea.cc b/nmea.cc index 0336c7e7f..fb2120ec5 100644 --- a/nmea.cc +++ b/nmea.cc @@ -203,14 +203,14 @@ arglist_t nmea_args[] = { {"gpgga", &opt_gpgga, "Read/write GPGGA sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, {"gpvtg", &opt_gpvtg, "Read/write GPVTG sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, {"gpgsa", &opt_gpgsa, "Read/write GPGSA sentences", "1", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, - {"date", &optdate, "Complete date-free tracks with given date (YYYYMMDD).", NULL, ARGTYPE_INT, ARG_NOMINMAX , nullptr }, + {"date", &optdate, "Complete date-free tracks with given date (YYYYMMDD).", nullptr, ARGTYPE_INT, ARG_NOMINMAX , nullptr }, { "get_posn", &getposnarg, "Return current position as a waypoint", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, - {"pause", &opt_sleep, "Decimal seconds to pause between groups of strings", NULL, ARGTYPE_INT, ARG_NOMINMAX , nullptr}, + {"pause", &opt_sleep, "Decimal seconds to pause between groups of strings", nullptr, ARGTYPE_INT, ARG_NOMINMAX , nullptr}, {"append_positioning", &opt_append, "Append realtime positioning data to the output file instead of truncating", "0", ARGTYPE_BOOL, ARG_NOMINMAX , nullptr}, - {"baud", &opt_baud, "Speed in bits per second of serial port (baud=4800)", NULL, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, + {"baud", &opt_baud, "Speed in bits per second of serial port (baud=4800)", nullptr, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, {"gisteq", &opt_gisteq, "Write tracks for Gisteq Phototracker", "0", ARGTYPE_BOOL, ARG_NOMINMAX , nullptr}, {"ignore_fix", &opt_ignorefix, "Accept position fixes in gpgga marked invalid", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr}, ARG_TERMINATOR @@ -244,7 +244,7 @@ nmea_add_wpt(Waypoint* wpt, route_head* trk) wpt->latitude = lat; wpt->longitude = lon; } - if (trk != NULL) { + if (trk != nullptr) { track_add_wpt(trk, wpt); } else { waypt_add(wpt); @@ -254,7 +254,7 @@ nmea_add_wpt(Waypoint* wpt, route_head* trk) static void nmea_release_wpt(Waypoint* wpt) { - if (wpt && ((wpt->Q.next == NULL) || (wpt->Q.next == &wpt->Q))) { + if (wpt && ((wpt->Q.next == nullptr) || (wpt->Q.next == &wpt->Q))) { /* This waypoint isn't queued. Release it, because we don't have any reference to this waypoint (! memory leak !) */ @@ -265,8 +265,8 @@ nmea_release_wpt(Waypoint* wpt) static void nmea_rd_init(const QString& fname) { - curr_waypt = NULL; - last_waypt = NULL; + curr_waypt = nullptr; + last_waypt = nullptr; last_time = -1; datum = DATUM_WGS84; had_checksum = 0; @@ -295,7 +295,7 @@ nmea_rd_init(const QString& fname) return; } wpt->shortname = "Position"; - nmea_add_wpt(wpt, NULL); + nmea_add_wpt(wpt, nullptr); return; } @@ -312,7 +312,7 @@ nmea_rd_deinit() break; case rm_file: gbfclose(file_in); - file_in = NULL; + file_in = nullptr; break; default: fatal("nmea_rd_deinit: illegal read_mode.\n"); @@ -349,9 +349,9 @@ nmea_wr_init(const QString& portname) setshort_length(mkshort_handle, atoi(snlenopt)); if (opt_gisteq) { - opt_gpgga = NULL; - opt_gpvtg = NULL; - opt_gpgsa = NULL; + opt_gpgga = nullptr; + opt_gpvtg = nullptr; + opt_gpgsa = nullptr; } } @@ -383,7 +383,7 @@ nmea_set_waypoint_time(Waypoint* wpt, struct tm* time, double fsec) static void gpgll_parse(char* ibuf) { - if (trk_head == NULL) { + if (trk_head == nullptr) { trk_head = route_head_alloc(); track_add_head(trk_head); } @@ -438,7 +438,7 @@ gpgll_parse(char* ibuf) static void gpgga_parse(char* ibuf) { - if (trk_head == NULL) { + if (trk_head == nullptr) { trk_head = route_head_alloc(); track_add_head(trk_head); } @@ -532,7 +532,7 @@ gpgga_parse(char* ibuf) static void gprmc_parse(char* ibuf) { - if (trk_head == NULL) { + if (trk_head == nullptr) { trk_head = route_head_alloc(); track_add_head(trk_head); } @@ -657,8 +657,8 @@ gpwpl_parse(char* ibuf) waypt->longitude = ddmm2degrees(lngdeg); waypt->shortname = sname; - curr_waypt = NULL; /* waypoints won't be updated with GPS fixes */ - nmea_add_wpt(waypt, NULL); + curr_waypt = nullptr; /* waypoints won't be updated with GPS fixes */ + nmea_add_wpt(waypt, nullptr); } static void @@ -853,16 +853,16 @@ pcmpt_parse(char* ibuf) static void nmea_fix_timestamps(route_head* track) { - if ((trk_head == NULL) || (without_date == 0)) { + if ((trk_head == nullptr) || (without_date == 0)) { return; } if (tm.tm_year == 0) { queue* elem, *temp; - Waypoint* prev = NULL; + Waypoint* prev = nullptr; time_t delta_tm; - if (optdate == NULL) { + if (optdate == nullptr) { warning(MYNAME ": No date found within track (all points dropped)!\n"); warning(MYNAME ": Please use option \"date\" to preset a valid date for thoose tracks.\n"); track_del_head(track); @@ -874,7 +874,7 @@ nmea_fix_timestamps(route_head* track) Waypoint* wpt = (Waypoint*)elem; wpt->creation_time += delta_tm; - if ((prev != NULL) && (prev->creation_time > wpt->creation_time)) { + if ((prev != nullptr) && (prev->creation_time > wpt->creation_time)) { /* go over midnight ? */ delta_tm += SECONDS_PER_DAY; wpt->creation_time += SECONDS_PER_DAY; @@ -946,7 +946,7 @@ nmea_parse_one_line(char* ibuf) } ck = strrchr(tbuf, '*'); - if (ck != NULL) { + if (ck != nullptr) { *ck = '\0'; ckval = nmea_cksum(&tbuf[1]); *ck = '*'; @@ -965,7 +965,7 @@ nmea_parse_one_line(char* ibuf) return; } - if (strstr(tbuf+1,"$")!=NULL) { + if (strstr(tbuf+1,"$")!=nullptr) { /* If line has more than one $, there is probably an error in it. */ return; } @@ -1024,7 +1024,7 @@ nmea_read() int line = -1; posn_type = gp_unknown; - trk_head = NULL; + trk_head = nullptr; without_date = 0; memset(&tm, 0, sizeof(tm)); opt_tm = tm; @@ -1038,14 +1038,14 @@ nmea_read() memset(&opt_tm, 0, sizeof(opt_tm)); ck = (char*)strptime(optdate, "%Y%m%d", &opt_tm); - if ((ck == NULL) || (*ck != '\0') || (strlen(optdate) != 8)) { + if ((ck == nullptr) || (*ck != '\0') || (strlen(optdate) != 8)) { fatal(MYNAME ": Invalid date \"%s\"!\n", optdate); } else if (opt_tm.tm_year < 70) { fatal(MYNAME ": Date \"%s\" is out of range (have to be 19700101 or later)!\n", optdate); } } - curr_waypt = NULL; + curr_waypt = nullptr; while ((ibuf = gbfgetstr(file_in))) { char* sdatum, *cx; @@ -1068,7 +1068,7 @@ nmea_read() /* Check the GPS datum */ cx = strchr(&ibuf[12], '/'); - if (cx != NULL) { + if (cx != nullptr) { char* edatum; sdatum = cx + 1; edatum = strchr(sdatum, '/'); @@ -1100,7 +1100,7 @@ nmea_read() void nmea_rd_posn_init(const QString& fname) { - if ((gbser_handle = gbser_init(qPrintable(fname))) != NULL) { + if ((gbser_handle = gbser_init(qPrintable(fname))) != nullptr) { read_mode = rm_serial; gbser_set_speed(gbser_handle, 4800); } else { @@ -1216,13 +1216,13 @@ nmea_rd_posn(posn_status*) Waypoint* w = curr_waypt; lt = last_read_time; - curr_waypt = NULL; + curr_waypt = nullptr; return w; } } } - return NULL; + return nullptr; } static void @@ -1383,7 +1383,7 @@ static void nmea_write() { waypt_disp_all(nmea_wayptpr); - track_disp_all(nmea_track_init, NULL, nmea_trackpt_pr); + track_disp_all(nmea_track_init, nullptr, nmea_trackpt_pr); } static void @@ -1418,7 +1418,7 @@ ff_vecs_t nmea_vecs = { nmea_wr_deinit, nmea_read, nmea_write, - NULL, + nullptr, nmea_args, CET_CHARSET_ASCII, 0, /* CET-REVIEW */ { diff --git a/nmn4.cc b/nmn4.cc index c1076f65b..0520cec32 100644 --- a/nmn4.cc +++ b/nmn4.cc @@ -43,7 +43,7 @@ static char* index_opt; static arglist_t nmn4_args[] = { - {"index", &index_opt, "Index of route to write (if more than one in source)", NULL, ARGTYPE_INT, "1", NULL , nullptr}, + {"index", &index_opt, "Index of route to write (if more than one in source)", nullptr, ARGTYPE_INT, "1", nullptr , nullptr}, ARG_TERMINATOR }; @@ -95,7 +95,7 @@ nmn4_read_data() column = -1; c = csv_lineparse(str, "|", "", column++); - while (c != NULL) { + while (c != nullptr) { switch (column) { case 0: /* "-" */ /* unknown fields for the moment */ case 1: /* "-" */ @@ -176,7 +176,7 @@ nmn4_read_data() break; } - c = QString::fromLatin1(csv_lineparse(NULL, "|", "", column++)); + c = QString::fromLatin1(csv_lineparse(nullptr, "|", "", column++)); } route_add_wpt(route, wpt); } @@ -229,7 +229,7 @@ nmn4_write_data() target_rte_num = 1; - if (index_opt != NULL) { + if (index_opt != nullptr) { target_rte_num = atoi(index_opt); is_fatal(((target_rte_num > (int) route_count()) || (target_rte_num < 1)), MYNAME ": invalid route number %d (1..%d))!\n", target_rte_num, route_count()); @@ -289,7 +289,7 @@ ff_vecs_t nmn4_vecs = { nmn4_wr_deinit, nmn4_read, nmn4_write, - NULL, + nullptr, nmn4_args, CET_CHARSET_MS_ANSI, 1 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/nukedata.cc b/nukedata.cc index df56a2590..3dc342d3b 100644 --- a/nukedata.cc +++ b/nukedata.cc @@ -60,10 +60,10 @@ nuke_process(void) } filter_vecs_t nuke_vecs = { - NULL, + nullptr, nuke_process, - NULL, - NULL, + nullptr, + nullptr, nuke_args }; diff --git a/osm.cc b/osm.cc index 3caf66ec5..869916bac 100644 --- a/osm.cc +++ b/osm.cc @@ -29,8 +29,8 @@ static char* opt_tag, *opt_tagnd, *created_by; static arglist_t osm_args[] = { - { "tag", &opt_tag, "Write additional way tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, - { "tagnd", &opt_tagnd, "Write additional node tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + { "tag", &opt_tag, "Write additional way tag key/value pairs", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr}, + { "tagnd", &opt_tagnd, "Write additional node tag key/value pairs", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "created_by", &created_by, "Use this value as custom created_by value","GPSBabel", ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -63,7 +63,7 @@ xg_tag_mapping osm_map[] = { { osm_way_tag, cb_start, "/osm/way/tag" }, { osm_way_center, cb_start, "/osm/way/center" }, { osm_way_end, cb_end, "/osm/way" }, - { NULL, (xg_cb_type)0, NULL } + { nullptr, (xg_cb_type)0, nullptr } }; static const char* osm_features[] = { @@ -87,7 +87,7 @@ static const char* osm_features[] = { "tourism", /* 17 */ "waterway", /* 18 */ "aerialway", /* 19 */ - NULL + nullptr }; typedef struct osm_icon_mapping_s { @@ -399,7 +399,7 @@ static osm_icon_mapping_t osm_icon_mappings[] = { // { 13, "island", "?" }, // { 13, "User Defined", "?" }, - { -1, NULL, NULL } + { -1, nullptr, nullptr } }; @@ -485,7 +485,7 @@ osm_node_end(xg_string, const QXmlStreamAttributes*) } else { delete wpt; } - wpt = NULL; + wpt = nullptr; } } @@ -662,7 +662,7 @@ osm_way_end(xg_string, const QXmlStreamAttributes*) { if (rte) { route_add_head(rte); - rte = NULL; + rte = nullptr; } if (wpt) { @@ -670,7 +670,7 @@ osm_way_end(xg_string, const QXmlStreamAttributes*) waypt_add(wpt); } else { delete(wpt); - wpt = NULL; + wpt = nullptr; } } } @@ -678,15 +678,15 @@ osm_way_end(xg_string, const QXmlStreamAttributes*) static void osm_rd_init(const QString& fname) { - wpt = NULL; - rte = NULL; + wpt = nullptr; + rte = nullptr; waypoints.clear(); if (keys.isEmpty()) { osm_features_init(); } - xml_init(fname, osm_map, NULL); + xml_init(fname, osm_map, nullptr); } static void @@ -777,7 +777,7 @@ osm_release_ids(const Waypoint* wpt) if (wpt && wpt->extra_data) { Waypoint* tmp = (Waypoint*)wpt; xfree(tmp->extra_data); - tmp->extra_data = NULL; + tmp->extra_data = nullptr; } } @@ -947,8 +947,8 @@ osm_write() gbfprintf(fout, "'>\n"); waypt_disp_all(osm_waypt_disp); - route_disp_all(NULL, NULL, osm_waypt_disp); - track_disp_all(NULL, NULL, osm_waypt_disp); + route_disp_all(nullptr, nullptr, osm_waypt_disp); + track_disp_all(nullptr, nullptr, osm_waypt_disp); route_disp_all(osm_rte_disp_head, osm_rte_disp_trail, osm_rtept_disp); track_disp_all(osm_rte_disp_head, osm_rte_disp_trail, osm_rtept_disp); @@ -962,8 +962,8 @@ osm_wr_deinit() gbfclose(fout); waypt_disp_all(osm_release_ids); - route_disp_all(NULL, NULL, osm_release_ids); - track_disp_all(NULL, NULL, osm_release_ids); + route_disp_all(nullptr, nullptr, osm_release_ids); + track_disp_all(nullptr, nullptr, osm_release_ids); waypoints.clear(); } diff --git a/ozi.cc b/ozi.cc index aae505241..9ff9eee48 100644 --- a/ozi.cc +++ b/ozi.cc @@ -53,15 +53,15 @@ static int route_out_count; static int route_wpt_count; static int new_track; -static char* snlenopt = NULL; -static char* snwhiteopt = NULL; -static char* snupperopt = NULL; -static char* snuniqueopt = NULL; -static char* wptfgcolor = NULL; -static char* wptbgcolor = NULL; -static char* pack_opt = NULL; +static char* snlenopt = nullptr; +static char* snwhiteopt = nullptr; +static char* snupperopt = nullptr; +static char* snuniqueopt = nullptr; +static char* wptfgcolor = nullptr; +static char* wptbgcolor = nullptr; +static char* pack_opt = nullptr; static int datum; -static char* proximityarg = NULL; +static char* proximityarg = nullptr; static double proximity; static char* altunit_opt; static char* proxunit_opt; @@ -74,23 +74,23 @@ static arglist_t ozi_args[] = { { "pack", &pack_opt, "Write all tracks into one file", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, { "snlen", &snlenopt, "Max synthesized shortname length", - "32", ARGTYPE_INT, "1", NULL + "32", ARGTYPE_INT, "1", nullptr }, { "snwhite", &snwhiteopt, "Allow whitespace synth. shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, { "snupper", &snupperopt, "UPPERCASE synth. shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, { "snunique", &snuniqueopt, "Make synth. shortnames unique", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX }, { "wptfgcolor", &wptfgcolor, "Waypoint foreground color", @@ -125,7 +125,7 @@ ozi_copy_fsdata(ozi_fsdata** dest, ozi_fsdata* src) /* No strings to mess with. Straight forward copy. */ *dest = (ozi_fsdata*)xmalloc(sizeof(*src)); ** dest = *src; - (*dest)->fs.next = NULL; + (*dest)->fs.next = nullptr; } static void @@ -142,7 +142,7 @@ ozi_alloc_fsdata() fsdata->fs.type = FS_OZI; fsdata->fs.copy = (fs_copy) ozi_copy_fsdata; fsdata->fs.destroy = ozi_free_fsdata; - fsdata->fs.convert = NULL; + fsdata->fs.convert = nullptr; /* Provide defaults via command line defaults */ fsdata->fgcolor = color_to_bbggrr(wptfgcolor); @@ -188,7 +188,7 @@ ozi_convert_datum(Waypoint* wpt) static void ozi_openfile(const QString& fname) { - const char* ozi_extensions[] = {0, "plt", "wpt", "rte"}; + const char* ozi_extensions[] = {nullptr, "plt", "wpt", "rte"}; /* if we're doing multi-track output, sequence the filenames like: * mytrack.plt, mytrack-1.plt...unless we're writing to stdout. @@ -221,7 +221,7 @@ ozi_openfile(const QString& fname) /* re-open file_out with the new filename */ if (file_out) { gbfclose(file_out); - file_out = NULL; + file_out = nullptr; } file_out = gbfopen(tmpname, "wb", MYNAME); @@ -428,7 +428,7 @@ static void rd_deinit() { gbfclose(file_in); - file_in = NULL; + file_in = nullptr; mkshort_del_handle(&mkshort_handle); } @@ -468,16 +468,16 @@ wr_init(const QString& fname) ozi_init_units(1); parse_distance(proximityarg, &proximity, 1 / prox_scale, MYNAME); - file_out = NULL; + file_out = nullptr; } static void wr_deinit() { - if (file_out != NULL) { + if (file_out != nullptr) { gbfclose(file_out); - file_out = NULL; + file_out = nullptr; } ozi_ofname.clear(); @@ -719,7 +719,7 @@ static void data_read() { QString buff; - char* trk_name = NULL; + char* trk_name = nullptr; Waypoint* wpt_tmp; int i; int linecount = 0; @@ -770,7 +770,7 @@ data_read() if (field == 4) { trk_head->rte_name = QString(s).trimmed(); } - s = csv_lineparse(NULL, ",", "", linecount); + s = csv_lineparse(nullptr, ",", "", linecount); } } @@ -808,7 +808,7 @@ data_read() break; } i++; - s = csv_lineparse(NULL, ",", "", linecount); + s = csv_lineparse(nullptr, ",", "", linecount); } xfree(orig_s); @@ -870,7 +870,7 @@ ozi_waypt_pr(const Waypoint* wpt) QString description; QString shortname; int faked_fsdata = 0; - ozi_fsdata* fs = NULL; + ozi_fsdata* fs = nullptr; int icon = 0; fs = (ozi_fsdata*) fs_chain_find(wpt->fs, FS_OZI); @@ -975,7 +975,7 @@ ff_vecs_t ozi_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, ozi_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/parse.cc b/parse.cc index 996ffc0fb..176ea4490 100644 --- a/parse.cc +++ b/parse.cc @@ -40,11 +40,11 @@ parse_distance(const char* str, double* val, double scale, const char* module) { char* unit; - if ((str == NULL) || (*str == '\0')) { + if ((str == nullptr) || (*str == '\0')) { return 0; } *val = strtod(str, &unit); - if (unit == NULL) { + if (unit == nullptr) { fatal("%s: Unconvertable numeric value (%s)!\n", module, str); } @@ -100,12 +100,12 @@ parse_speed(const char* str, double* val, const double scale, const char* module { char* unit; - if ((str == NULL) || (*str == '\0')) { + if ((str == nullptr) || (*str == '\0')) { return 0; } *val = strtod(str, &unit); - if (unit == NULL) { + if (unit == nullptr) { fatal("%s: Unconvertable numeric value (%s)!\n", module, str); } diff --git a/pcx.cc b/pcx.cc index 67368e8e3..5daa6da48 100644 --- a/pcx.cc +++ b/pcx.cc @@ -31,7 +31,7 @@ static gbfile* file_in, *file_out; static short_handle mkshort_handle; static short_handle mkshort_handle2; /* for track and route names */ -static char* deficon = NULL; +static char* deficon = nullptr; static char* cartoexploreur; static int read_as_degrees; static int read_gpsu; @@ -47,7 +47,7 @@ static arglist_t pcx_args[] = {{"deficon", &deficon, "Default icon name", "Waypoint", ARGTYPE_STRING, ARG_NOMINMAX}, {"cartoexploreur", &cartoexploreur, "Write tracks compatible with Carto Exploreur", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX}, + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX}, ARG_TERMINATOR}; static void rd_init(const QString& fname) { @@ -98,8 +98,8 @@ static void data_read() { int symnum; Waypoint* wpt_tmp; char* buff; - route_head* track = NULL; - route_head* route = NULL; + route_head* track = nullptr; + route_head* route = nullptr; int points; int line_number = 0; @@ -181,7 +181,7 @@ static void data_read() { wpt_tmp->latitude = ddmm2degrees(lat); } - if (route != NULL) { + if (route != nullptr) { route_add_wpt(route, new Waypoint(*wpt_tmp)); } waypt_add(wpt_tmp); @@ -195,10 +195,10 @@ static void data_read() { H(2 chars)TN(tracknane\0) */ if (points > 0) { - track = NULL; + track = nullptr; points = 0; } - if (track == NULL) { + if (track == nullptr) { if (ibuf[3] == 'L' && ibuf[4] == 'A') { track = route_head_alloc(); track->rte_name = "track"; @@ -256,7 +256,7 @@ static void data_read() { wpt_tmp->altitude = alt; /* Did we get a track point before a track header? */ - if (track == NULL) { + if (track == nullptr) { track = route_head_alloc(); track->rte_name = "Default"; track_add_head(track); @@ -275,7 +275,7 @@ static void data_read() { // of "LAT LON DM" - unlike the other, it actually IS decimal // minutes. case 'I': - read_gpsu = !(strstr(ibuf, "GPSU") == NULL); + read_gpsu = !(strstr(ibuf, "GPSU") == nullptr); break; // This is a format specifier. Use this line to figure out // where our other columns start. @@ -317,7 +317,7 @@ static void gpsutil_disp(const Waypoint* wpt) { : CSTRc(wpt->shortname), lat < 0.0 ? 'S' : 'N', fabs(lat), lon < 0.0 ? 'W' : 'E', fabs(lon), CSTR(ds), (wpt->altitude == unknown_alt) ? -9999 : wpt->altitude, - (wpt->description != NULL) ? CSTRc(wpt->description) : "", 0.0, + (wpt->description != nullptr) ? CSTRc(wpt->description) : "", 0.0, icon_token); } @@ -399,16 +399,16 @@ static void data_write() { waypt_disp_all(gpsutil_disp); } else if (global_opts.objective == trkdata) { route_ctr = 0; - track_disp_all(pcx_track_hdr, NULL, pcx_track_disp); + track_disp_all(pcx_track_hdr, nullptr, pcx_track_disp); } else if (global_opts.objective == rtedata) { route_ctr = 0; - route_disp_all(pcx_route_hdr, NULL, gpsutil_disp); + route_disp_all(pcx_route_hdr, nullptr, gpsutil_disp); } } ff_vecs_t pcx_vecs = { ff_type_file, FF_CAP_RW_ALL, rd_init, wr_init, rd_deinit, - wr_deinit, data_read, data_write, NULL, pcx_args, + wr_deinit, data_read, data_write, nullptr, pcx_args, CET_CHARSET_ASCII, 1 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/pocketfms_bc.cc b/pocketfms_bc.cc index 2f8364d7a..d32deed50 100644 --- a/pocketfms_bc.cc +++ b/pocketfms_bc.cc @@ -187,8 +187,8 @@ ff_vecs_t pocketfms_bc_vecs = { wr_deinit, data_read, data_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/pocketfms_fp.cc b/pocketfms_fp.cc index 469d33e1a..f84420763 100644 --- a/pocketfms_fp.cc +++ b/pocketfms_fp.cc @@ -25,7 +25,7 @@ #include static int isFirst = 1; -static route_head* route = NULL; +static route_head* route = nullptr; static Waypoint* wpt_to, *wpt_from; static double dest_altitude; @@ -46,13 +46,13 @@ static xg_tag_mapping gl_map[] = { { wpt_to_elev, cb_cdata, "/PocketFMSFlightplan/LIB/ToPoint/Elevation" }, { wpt_altitude, cb_start, "/PocketFMSFlightplan/LIB/PlannedAltitude" }, { wpt_e, cb_end, "/PocketFMSFlightplan/LIB" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; static void rd_init(const QString& fname) { - xml_init(fname, gl_map, NULL); + xml_init(fname, gl_map, nullptr); } static void @@ -64,14 +64,14 @@ data_read() static void rd_deinit() { - if (route != NULL) { + if (route != nullptr) { Waypoint* head = (Waypoint*) QUEUE_FIRST(&route->waypoint_list); Waypoint* tail = (Waypoint*) QUEUE_LAST(&route->waypoint_list); - if (head != NULL) { + if (head != nullptr) { route->rte_name = head->shortname; } route->rte_name += " - "; - if (tail != NULL) { + if (tail != nullptr) { route->rte_name += tail->shortname; tail->altitude = dest_altitude; } @@ -103,40 +103,40 @@ void wpt_e(xg_string, const QXmlStreamAttributes*) if (doing_wpts) { waypt_add(new Waypoint(*wpt_from)); } - wpt_from = NULL; + wpt_from = nullptr; isFirst = 0; } route_add_wpt(route, wpt_to); if (doing_wpts) { waypt_add(new Waypoint(*wpt_to)); } - wpt_to = NULL; + wpt_to = nullptr; } void wpt_from_lat(xg_string args, const QXmlStreamAttributes*) { - if (wpt_from != NULL) { + if (wpt_from != nullptr) { wpt_from->latitude = args.toDouble(); } } void wpt_from_lon(xg_string args, const QXmlStreamAttributes*) { - if (wpt_from != NULL) { + if (wpt_from != nullptr) { wpt_from->longitude = args.toDouble(); } } void wpt_from_name(xg_string args, const QXmlStreamAttributes*) { - if (wpt_from != NULL) { + if (wpt_from != nullptr) { wpt_from->shortname += args; } } void wpt_from_elev(xg_string args, const QXmlStreamAttributes*) { - if (wpt_from != NULL) { + if (wpt_from != nullptr) { wpt_from->altitude = FEET_TO_METERS(args.toDouble()); } } @@ -186,11 +186,11 @@ ff_vecs_t pocketfms_fp_vecs = { rd_init, wr_init, rd_deinit, - NULL, + nullptr, data_read, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/pocketfms_wp.cc b/pocketfms_wp.cc index 6cad12f06..5c3d9cf14 100644 --- a/pocketfms_wp.cc +++ b/pocketfms_wp.cc @@ -35,7 +35,7 @@ rd_init(const QString& fname) double wppos_to_dec(char* value) { - if (strstr(value, "\xB0") == NULL) { + if (strstr(value, "\xB0") == nullptr) { return atof(value); } else { int degrees, minutes; @@ -74,13 +74,13 @@ data_read() fatal(MYNAME "Invalid name"); } wpt->shortname = s; - s = csv_lineparse(NULL, "\\w", "", linecount); + s = csv_lineparse(nullptr, "\\w", "", linecount); if (!s) { fatal(MYNAME "Invalid latitude %s", qPrintable(wpt->shortname)); } wpt->latitude = wppos_to_dec(s); - s = csv_lineparse(NULL, "\\w", "", linecount); + s = csv_lineparse(nullptr, "\\w", "", linecount); if (!s) { fatal(MYNAME "Invalid longitude %s", qPrintable(wpt->shortname)); } @@ -148,8 +148,8 @@ ff_vecs_t pocketfms_wp_vecs = { wr_deinit, data_read, data_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/polygon.cc b/polygon.cc index 566579ff1..1f4ade8b9 100644 --- a/polygon.cc +++ b/polygon.cc @@ -25,8 +25,8 @@ #if FILTERS_ENABLED #define MYNAME "Polygon filter" -static char* polyfileopt = NULL; -static char* exclopt = NULL; +static char* polyfileopt = nullptr; +static char* exclopt = nullptr; /* * This test for insideness is essentially an odd/even test. The @@ -112,11 +112,11 @@ static arglist_t polygon_args[] = { { "file", &polyfileopt, "File containing vertices of polygon", - NULL, ARGTYPE_FILE | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FILE | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, { "exclude", &exclopt, "Exclude points inside the polygon", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -251,7 +251,7 @@ polygon_process() olat = olon = lat1 = lon1 = lat2 = lon2 = BADVAL; while ((line = gbfgetstr(file_in))) { - char* pound = NULL; + char* pound = nullptr; int argsfound = 0; fileline++; @@ -326,12 +326,12 @@ polygon_process() Waypoint* wp = (Waypoint*) elem; #endif ed = (extra_data*) wp->extra_data; - wp->extra_data = NULL; + wp->extra_data = nullptr; if (ed) { if (ed->override) { ed->state = INSIDE; } - if (((ed->state & INSIDE) == OUTSIDE) == (exclopt == NULL)) { + if (((ed->state & INSIDE) == OUTSIDE) == (exclopt == nullptr)) { waypt_del(wp); delete wp; } @@ -356,7 +356,7 @@ filter_vecs_t polygon_vecs = { polygon_init, polygon_process, polygon_deinit, - NULL, + nullptr, polygon_args }; #endif // FILTERS_ENABLED diff --git a/position.cc b/position.cc index 0d5d54725..5d532e272 100644 --- a/position.cc +++ b/position.cc @@ -31,13 +31,13 @@ # define M_PI 3.14159265358979323846 #endif -static route_head* cur_rte = NULL; +static route_head* cur_rte = nullptr; static double pos_dist; static double max_diff_time; -static char* distopt = NULL; -static char* timeopt = NULL; -static char* purge_duplicates = NULL; +static char* distopt = nullptr; +static char* timeopt = nullptr; +static char* purge_duplicates = nullptr; static int check_time; typedef struct { @@ -48,16 +48,16 @@ static arglist_t position_args[] = { { "distance", &distopt, "Maximum positional distance", - NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, { "all", &purge_duplicates, "Suppress all points close to other points", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "time", &timeopt, "Maximum time in seconds beetween two points", - NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -173,7 +173,7 @@ position_process_any_route(const route_head* rh, int type) if (i) { cur_rte = (route_head*)rh; position_runqueue((queue*)&rh->waypoint_list, i, type); - cur_rte = NULL; + cur_rte = nullptr; } } @@ -245,7 +245,7 @@ filter_vecs_t position_vecs = { position_init, position_process, position_deinit, - NULL, + nullptr, position_args }; diff --git a/psitrex.cc b/psitrex.cc index 249137e67..74713c17c 100644 --- a/psitrex.cc +++ b/psitrex.cc @@ -141,7 +141,7 @@ const psit_icon_mapping_t psit_icon_value_table[] = { { 0x400a, "ultralight" }, { 0x400b, "parachute" }, { 0x4012, "seaplane" }, - { -1, NULL } + { -1, nullptr } }; static const char* @@ -230,7 +230,7 @@ psit_getToken(gbfile* psit_file, char* buf, size_t sz, psit_tokenSep_type delimT } if (c == '#') { - if (gbfgets(buf, sz, psit_file) == NULL) { + if (gbfgets(buf, sz, psit_file) == nullptr) { *buf = 0; return; } @@ -342,7 +342,7 @@ psit_waypoint_w(gbfile* psit_file, const Waypoint* wpt) { int icon; const char* ident; - char* src = 0; /* BUGBUG Passed to mkshort */ + char* src = nullptr; /* BUGBUG Passed to mkshort */ gbfprintf(psit_file, "%11.6f,%11.6f,", wpt->latitude, @@ -516,7 +516,7 @@ psit_track_r(gbfile* psit_file, route_head**) struct tm tmTime; time_t dateTime = 0; - route_head* track_head = NULL; + route_head* track_head = nullptr; Waypoint* thisWaypoint; psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), ltrimEOL); @@ -529,7 +529,7 @@ psit_track_r(gbfile* psit_file, route_head**) rtrim(trkname); trk_num = 0; - track_head = NULL; + track_head = nullptr; psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), wscomma); @@ -572,7 +572,7 @@ psit_track_r(gbfile* psit_file, route_head**) psit_getToken(psit_file,psit_current_token,sizeof(psit_current_token), whitespace); - if ((strcmp(psit_current_token, "1") == 0) || (track_head == NULL)) { + if ((strcmp(psit_current_token, "1") == 0) || (track_head == nullptr)) { track_head = route_head_alloc(); /* Add a number to the track name. With Garmins, the "first" tracklog is usually ACTIVE LOG @@ -795,7 +795,7 @@ ff_vecs_t psit_vecs = { psit_wr_deinit, psit_read, psit_write, - NULL, + nullptr, psit_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/queue.cc b/queue.cc index e5f40494e..8f13029c2 100644 --- a/queue.cc +++ b/queue.cc @@ -116,8 +116,8 @@ sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)) while (true) { p = list; oldhead = list; /* only used for circular linkage */ - list = NULL; - tail = NULL; + list = nullptr; + tail = nullptr; nmerges = 0; /* count number of merges we do in this pass */ @@ -128,7 +128,7 @@ sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)) psize = 0; for (i = 0; i < insize; i++) { psize++; - q = (q->next == oldhead ? NULL : q->next); + q = (q->next == oldhead ? nullptr : q->next); if (!q) { break; } @@ -150,7 +150,7 @@ sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)) q = q->next; qsize--; if (q == oldhead) { - q = NULL; + q = nullptr; } } else if (qsize == 0 || !q) { /* q is empty; e must come from p. */ @@ -158,7 +158,7 @@ sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)) p = p->next; psize--; if (p == oldhead) { - p = NULL; + p = nullptr; } } else if (cmp(p,q) <= 0) { /* First element of p is @@ -169,7 +169,7 @@ sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)) p = p->next; psize--; if (p == oldhead) { - p = NULL; + p = nullptr; } } else { /* First element of q is @@ -180,7 +180,7 @@ sortqueue(queue* qh, int (*cmp)(const queue*, const queue*)) q = q->next; qsize--; if (q == oldhead) { - q = NULL; + q = nullptr; } } diff --git a/radius.cc b/radius.cc index 3a37bbfab..a999f5bff 100644 --- a/radius.cc +++ b/radius.cc @@ -31,13 +31,13 @@ #endif static double pos_dist; -static char* distopt = NULL; -static char* latopt = NULL; -static char* lonopt = NULL; -static char* exclopt = NULL; -static char* nosort = NULL; -static char* maxctarg = NULL; -static char* routename = NULL; +static char* distopt = nullptr; +static char* latopt = nullptr; +static char* lonopt = nullptr; +static char* exclopt = nullptr; +static char* nosort = nullptr; +static char* maxctarg = nullptr; +static char* routename = nullptr; static int maxct; static Waypoint* home_pos; @@ -50,31 +50,31 @@ static arglist_t radius_args[] = { { "lat", &latopt, "Latitude for center point (D.DDDDD)", - NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, { "lon", &lonopt, "Longitude for center point (D.DDDDD)", - NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, { "distance", &distopt, "Maximum distance from center", - NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_FLOAT | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, { "exclude", &exclopt, "Exclude points close to center", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "nosort", &nosort, "Inhibit sort by distance to center", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "maxcount", &maxctarg,"Output no more than this number of points", - NULL, ARGTYPE_INT, "1", NULL, nullptr + nullptr, ARGTYPE_INT, "1", nullptr, nullptr }, { "asroute", &routename,"Put resulting waypoints in route of this name", - NULL, ARGTYPE_STRING, NULL, NULL, nullptr + nullptr, ARGTYPE_STRING, nullptr, nullptr, nullptr }, ARG_TERMINATOR }; @@ -118,7 +118,7 @@ radius_process() Waypoint** comp; int i, wc; queue temp_head; - route_head* rte_head = NULL; + route_head* rte_head = nullptr; #if NEWQ foreach(Waypoint* waypointp, waypt_list) { #else @@ -133,7 +133,7 @@ radius_process() /* convert radians to float point statute miles */ dist = radtomiles(dist); - if ((dist >= pos_dist) == (exclopt == NULL)) { + if ((dist >= pos_dist) == (exclopt == nullptr)) { waypt_del(waypointp); delete waypointp; continue; @@ -187,7 +187,7 @@ radius_process() Waypoint* wp = comp[i]; xfree(wp->extra_data); - wp->extra_data = NULL; + wp->extra_data = nullptr; if (maxctarg && i >= maxct) { continue; @@ -246,7 +246,7 @@ filter_vecs_t radius_vecs = { radius_init, radius_process, radius_deinit, - NULL, + nullptr, radius_args }; #endif // FILTERS_ENABLED diff --git a/random.cc b/random.cc index f32a16986..89631f4dc 100644 --- a/random.cc +++ b/random.cc @@ -30,12 +30,12 @@ static char* opt_points, *opt_seed; static arglist_t random_args[] = { { - "points", &opt_points, "Generate # points", NULL, - ARGTYPE_INT, "1", NULL, nullptr + "points", &opt_points, "Generate # points", nullptr, + ARGTYPE_INT, "1", nullptr, nullptr }, { - "seed", &opt_seed, "Starting seed of the internal number generator", NULL, - ARGTYPE_INT, "1", NULL, nullptr + "seed", &opt_seed, "Starting seed of the internal number generator", nullptr, + ARGTYPE_INT, "1", nullptr, nullptr }, ARG_TERMINATOR }; @@ -113,7 +113,7 @@ random_read() int i, points; route_head* head; - Waypoint* prev = NULL; + Waypoint* prev = nullptr; time_t time = gpsbabel_time; if (opt_seed) { @@ -133,12 +133,12 @@ random_read() head->rte_name = rand_qstr(8, "Rte_%s"); route_add_head(head); } - head->rte_desc = rand_qstr(16, NULL); + head->rte_desc = rand_qstr(16, nullptr); if RND(3) { head->rte_url = rand_qstr(8, "http://rteurl.example.com/%s"); } } else { - head = NULL; + head = nullptr; } for (i = 0; i < points; i++) { @@ -152,7 +152,7 @@ random_read() do { wpt->shortname = rand_qstr(8, "Wpt_%s"); - } while (wpt->shortname == NULL); + } while (wpt->shortname == nullptr); wpt->latitude = rand_dbl(180) - 90; wpt->longitude = rand_dbl(360) - 180; @@ -260,12 +260,12 @@ ff_vecs_t random_vecs = { ff_cap_read /* routes */ }, random_rd_init, - NULL, /* wr_init */ + nullptr, /* wr_init */ random_rd_deinit, - NULL, /* wr_deinit */ + nullptr, /* wr_deinit */ random_read, - NULL, /* write */ - NULL, /* exit */ + nullptr, /* write */ + nullptr, /* exit */ random_args, CET_CHARSET_ASCII, 1 /* fixed */ , NULL_POS_OPS, diff --git a/raymarine.cc b/raymarine.cc index 49b6fd0b4..b9e4c535e 100644 --- a/raymarine.cc +++ b/raymarine.cc @@ -198,13 +198,13 @@ raymarine_read() snprintf(sect, sizeof(sect), "Wp%d", ix); /* try to read our most expected values */ - if (NULL == (name = inifile_readstr(fin, sect, "Name"))) { + if (nullptr == (name = inifile_readstr(fin, sect, "Name"))) { break; } - if (NULL == (lat = inifile_readstr(fin, sect, "Lat"))) { + if (nullptr == (lat = inifile_readstr(fin, sect, "Lat"))) { break; } - if (NULL == (lon = inifile_readstr(fin, sect, "Long"))) { + if (nullptr == (lon = inifile_readstr(fin, sect, "Long"))) { break; } @@ -240,7 +240,7 @@ raymarine_read() int wx; snprintf(sect, sizeof(sect), "Rt%d", rx); - if (NULL == (name = inifile_readstr(fin, sect, "Name"))) { + if (nullptr == (name = inifile_readstr(fin, sect, "Name"))) { break; } @@ -255,12 +255,12 @@ raymarine_read() snprintf(buff, sizeof(buff), "Mk%d", wx); str = inifile_readstr(fin, sect, buff); - if ((str == NULL) || (*str == '\0')) { + if ((str == nullptr) || (*str == '\0')) { break; } wpt = find_waypt_by_name(str); - if (wpt == NULL) + if (wpt == nullptr) fatal(MYNAME ": No associated waypoint for route point %s (Route %s)!\n", str, qPrintable(rte->rte_name)); @@ -342,9 +342,9 @@ write_waypoint(gbfile* fout, const Waypoint* wpt, const int waypt_no, const char double time; notes = wpt->notes; - if (notes == NULL) { + if (notes == nullptr) { notes = wpt->description; - if (notes == NULL) { + if (notes == nullptr) { notes = ""; } } @@ -477,11 +477,11 @@ raymarine_write() waypt_table_sz = 0; waypt_table_ct = 0; - waypt_table = NULL; + waypt_table = nullptr; /* enumerate all possible waypoints */ waypt_disp_all(enum_waypt_cb); - route_disp_all(enum_route_hdr_cb, NULL, enum_rtept_cb); + route_disp_all(enum_route_hdr_cb, nullptr, enum_rtept_cb); if (waypt_table_ct == 0) { return; @@ -497,13 +497,13 @@ raymarine_write() /* write out all routes with their waypoints */ rte_index = 0; - route_disp_all(write_route_head_cb, NULL, write_route_wpt_cb); + route_disp_all(write_route_head_cb, nullptr, write_route_wpt_cb); /* release local used data */ for (i = 0; i < waypt_table_ct; i++) { wpt = waypt_table[i]; xfree(wpt->extra_data); - wpt->extra_data = NULL; + wpt->extra_data = nullptr; } xfree(waypt_table); } @@ -525,7 +525,7 @@ ff_vecs_t raymarine_vecs = { raymarine_wr_done, raymarine_read, raymarine_write, - NULL, + nullptr, raymarine_args, CET_CHARSET_ASCII, 0 /* should we force this to 1 ? */ , NULL_POS_OPS, diff --git a/reverse_route.cc b/reverse_route.cc index c072caf84..f92848055 100644 --- a/reverse_route.cc +++ b/reverse_route.cc @@ -58,8 +58,8 @@ reverse_route_head(const route_head* rte) void reverse_route_process() { - track_disp_all(reverse_route_head, NULL, reverse_route_wpt); - route_disp_all(reverse_route_head, NULL, NULL); + track_disp_all(reverse_route_head, nullptr, reverse_route_wpt); + route_disp_all(reverse_route_head, nullptr, nullptr); } void @@ -86,7 +86,7 @@ filter_vecs_t reverse_route_vecs = { reverse_route_init, reverse_route_process, reverse_route_deinit, - NULL, + nullptr, reverse_route_args }; #endif diff --git a/route.cc b/route.cc index 6d6be6732..31326e245 100644 --- a/route.cc +++ b/route.cc @@ -75,7 +75,7 @@ static void any_route_free(route_head* rte) { delete rte; - rte = NULL; + rte = nullptr; } static void @@ -142,7 +142,7 @@ common_route_by_name(queue* routes, const char* name) } } - return NULL; + return nullptr; } route_head* @@ -223,7 +223,7 @@ route_find_waypt_by_name(route_head* rh, const char* name) return waypointp; } } - return NULL; + return nullptr; } static void @@ -437,7 +437,7 @@ track_append(queue* src) void route_backup(signed int* count, queue** head_bak) { - route_copy(count, NULL, head_bak, &my_route_head); + route_copy(count, nullptr, head_bak, &my_route_head); } static void @@ -488,7 +488,7 @@ common_restore_finish() void route_restore(queue* head_bak) { - if (head_bak == NULL) { + if (head_bak == nullptr) { return; } @@ -502,13 +502,13 @@ route_restore(queue* head_bak) void track_backup(signed int* count, queue** head_bak) { - route_copy(count, NULL, head_bak, &my_track_head); + route_copy(count, nullptr, head_bak, &my_track_head); } void track_restore(queue* head_bak) { - if (head_bak == NULL) { + if (head_bak == nullptr) { return; } @@ -694,7 +694,7 @@ void track_recompute(const route_head* trk, computed_trkdata** trkdatap) route_head::route_head() : rte_num(0), rte_waypt_ct(0), - fs(NULL), + fs(nullptr), cet_converted(0), // line_color(), line_width(-1), diff --git a/saroute.cc b/saroute.cc index e80827d99..fc17691ae 100644 --- a/saroute.cc +++ b/saroute.cc @@ -27,11 +27,11 @@ gbfile* infile; -char* turns_important = NULL; -char* turns_only = NULL; -char* controls = NULL; -char* split = NULL; -char* timesynth = NULL; +char* turns_important = nullptr; +char* turns_only = nullptr; +char* controls = nullptr; +char* split = nullptr; +char* timesynth = nullptr; int control = 0; @@ -40,15 +40,15 @@ arglist_t saroute_args[] = { { "turns_important", &turns_important, "Keep turns if simplify filter is used", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "turns_only", &turns_only, "Only read turns; skip all other points", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "split", &split, "Split into multiple routes at turns", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "controls", &controls, "Read control points as waypoint/route/none", @@ -56,7 +56,7 @@ arglist_t saroute_args[] = { }, { "times", ×ynth, "Synthesize track times", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -129,10 +129,10 @@ my_read() } *latlon; struct ll mylatlon; uint16_t coordcount; - route_head* track_head = NULL; - route_head* old_track_head = NULL; + route_head* track_head = nullptr; + route_head* old_track_head = nullptr; Waypoint* wpt_tmp; - char* routename = NULL; + char* routename = nullptr; double seglen = 0.0; int32_t starttime = 0; int32_t transittime = 0; @@ -311,7 +311,7 @@ my_read() } } while (count) { - old_track_head = NULL; + old_track_head = nullptr; ReadShort(infile); recsize = ReadLong(infile); record = ReadRecord(infile, recsize); @@ -434,7 +434,7 @@ my_read() route_add_wpt(old_track_head, new Waypoint(*wpt_tmp)); } - old_track_head = NULL; + old_track_head = nullptr; } } @@ -475,10 +475,10 @@ ff_vecs_t saroute_vecs = { rd_init, wr_init, rd_deinit, - NULL, + nullptr, my_read, - NULL, - NULL, + nullptr, + nullptr, saroute_args, CET_CHARSET_UTF8, 1 /* do nothing | CET-REVIEW */ , NULL_POS_OPS, diff --git a/sbn.cc b/sbn.cc index f70195c28..a8e225a71 100644 --- a/sbn.cc +++ b/sbn.cc @@ -24,7 +24,7 @@ #define MYNAME "sbn" -static gbfile* file_handle = NULL; +static gbfile* file_handle = nullptr; static arglist_t sbn_args[] = { @@ -240,7 +240,7 @@ decode_sbn_position(const unsigned char* buffer, Waypoint* waypt) static Waypoint* decode_sbn_record(unsigned char* buffer) { - Waypoint* waypt = NULL; + Waypoint* waypt = nullptr; waypt = new Waypoint; if (is_sbn_valid(buffer)) { @@ -321,11 +321,11 @@ ff_vecs_t sbn_vecs = { ff_cap_none /* routes */ }, sbn_rd_init, - NULL, + nullptr, sbn_rd_deinit, - NULL, + nullptr, sbn_read, - NULL, + nullptr, sbn_exit, sbn_args, /* Characters are always encoded in ASCII. Even if the unit is set diff --git a/sbp.cc b/sbp.cc index b0143e429..ac4aa14f4 100644 --- a/sbp.cc +++ b/sbp.cc @@ -25,7 +25,7 @@ #define MYNAME "sbp" -static gbfile* file_handle = NULL; +static gbfile* file_handle = nullptr; static arglist_t sbp_args[] = { @@ -91,7 +91,7 @@ read_logpoint() return navilink_decode_logpoint(buffer); } - return NULL; + return nullptr; } static void @@ -125,11 +125,11 @@ ff_vecs_t sbp_vecs = { ff_cap_none /* routes */ }, sbp_rd_init, - NULL, + nullptr, sbp_rd_deinit, - NULL, + nullptr, sbp_read, - NULL, + nullptr, sbp_exit, sbp_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ diff --git a/shape.cc b/shape.cc index 0c79a8db8..56396db35 100644 --- a/shape.cc +++ b/shape.cc @@ -43,18 +43,18 @@ static QString ifname; static QString ofname; static int nameFieldIdx; // the field index of the field with fieldName "name" in the output DBF. -static char* opt_name = NULL; -static char* opt_url = NULL; +static char* opt_name = nullptr; +static char* opt_url = nullptr; static arglist_t shp_args[] = { { "name", &opt_name, "Source for name field in .dbf", - NULL, ARGTYPE_STRING, "0", NULL, nullptr + nullptr, ARGTYPE_STRING, "0", nullptr, nullptr }, { "url", &opt_url, "Source for URL field in .dbf", - NULL, ARGTYPE_STRING, "0", NULL, nullptr + nullptr, ARGTYPE_STRING, "0", nullptr, nullptr }, ARG_TERMINATOR }; @@ -167,7 +167,7 @@ void dump_fields(void) warning(MYNAME ": Database fields:\n"); const int nFields = DBFGetFieldCount(ihandledb); for (int i = 0; i < nFields; i++) { - DBFFieldType type = DBFGetFieldInfo(ihandledb, i, name, NULL, NULL); + DBFFieldType type = DBFGetFieldInfo(ihandledb, i, name, nullptr, nullptr); warning(MYNAME ": Field Index: %2d, Field Name: %12s, Field Type %d\n", i, name, type); } fatal("\n"); @@ -201,12 +201,12 @@ my_rd_init(const QString& fname) ifname = fname; // TODO: The .prj file can define the the coordinate system and projection information. ihandle = SHPOpenGpsbabel(fname, "rb"); - if (ihandle == NULL) { + if (ihandle == nullptr) { fatal(MYNAME ": Cannot open shp file %s for reading\n", qPrintable(ifname)); } ihandledb = DBFOpenGpsbabel(fname, "rb"); - if (ihandledb == NULL) { + if (ihandledb == nullptr) { fatal(MYNAME ": Cannot open dbf file %s for reading\n", qPrintable(ifname)); } const char* codepage = DBFGetCodePage(ihandledb); @@ -286,7 +286,7 @@ my_read(void) int npts; const char* etype = "unknown"; - SHPGetInfo(ihandle, &npts, NULL, NULL, NULL); + SHPGetInfo(ihandle, &npts, nullptr, nullptr, nullptr); for (int iShape=0; iShaperte_waypt_ct <= 0) { return; } @@ -256,7 +256,7 @@ skyforce_read() route_head* rte, *trk; wpt_num = 0; - rte = trk = NULL; + rte = trk = nullptr; rte_num = -1; while ((str = gbfgetstr(fin))) { @@ -272,8 +272,8 @@ skyforce_read() switch (*str) { case 'W': - wpt = skyforce_parse_wpt(str, NULL); - if (wpt == NULL) { + wpt = skyforce_parse_wpt(str, nullptr); + if (wpt == nullptr) { continue; } waypt_add(wpt); @@ -281,16 +281,16 @@ skyforce_read() case 'R': wpt = skyforce_parse_wpt(str, &i); - if (wpt == NULL) { + if (wpt == nullptr) { continue; } if (i != rte_num) { rte_num = i; - rte = NULL; + rte = nullptr; } - if (rte == NULL) { + if (rte == nullptr) { rte = route_head_alloc(); route_add_head(rte); rte->rte_num = rte_num; @@ -300,10 +300,10 @@ skyforce_read() case 'L': wpt = skyforce_parse_trk(str); - if (wpt == NULL) { + if (wpt == nullptr) { continue; } - if (trk == NULL) { + if (trk == nullptr) { trk = route_head_alloc(); track_add_head(trk); } @@ -357,11 +357,11 @@ skyforce_write() case rtedata: setshort_defname(short_h, "RTE"); setshort_mustuniq(short_h, 0); - route_disp_all(skyforce_head_disp_cb, NULL, skyforce_waypt_disp_cb); + route_disp_all(skyforce_head_disp_cb, nullptr, skyforce_waypt_disp_cb); break; case trkdata: - track_disp_all(skyforce_head_disp_cb, NULL, skyforce_waypt_disp_cb); + track_disp_all(skyforce_head_disp_cb, nullptr, skyforce_waypt_disp_cb); break; case posndata: @@ -385,7 +385,7 @@ ff_vecs_t skyforce_vecs = { skyforce_wr_deinit, skyforce_read, skyforce_write, - NULL, + nullptr, skyforce_args, CET_CHARSET_ASCII, 1 , NULL_POS_OPS, diff --git a/skytraq.cc b/skytraq.cc index b80a18b25..acc1ac279 100644 --- a/skytraq.cc +++ b/skytraq.cc @@ -54,21 +54,21 @@ #define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) -static void* serial_handle = 0; /* IO file descriptor */ +static void* serial_handle = nullptr; /* IO file descriptor */ static int skytraq_baud = 0; /* detected baud rate */ -static gbfile* file_handle = 0; /* file descriptor (used by skytraq-bin format) */ - -static char* opt_erase = 0; /* erase after read? (0/1) */ -static char* opt_initbaud = 0; /* baud rate used to init device */ -static char* opt_dlbaud = 0; /* baud rate used for downloading tracks */ -static char* opt_read_at_once = 0; /* number of sectors to read at once (Venus6 only) */ -static char* opt_first_sector = 0; /* first sector to be read from the device (default: 0) */ -static char* opt_last_sector = 0; /* last sector to be read from the device (default: smart read everything) */ -static char* opt_dump_file = 0; /* dump raw data to this file (optional) */ -static char* opt_no_output = 0; /* disable output? (0/1) */ -static char* opt_set_location = 0; /* set if the "targetlocation" options was used */ -static char* opt_configure_logging = 0; -static char* opt_gps_utc_offset = 0; +static gbfile* file_handle = nullptr; /* file descriptor (used by skytraq-bin format) */ + +static char* opt_erase = nullptr; /* erase after read? (0/1) */ +static char* opt_initbaud = nullptr; /* baud rate used to init device */ +static char* opt_dlbaud = nullptr; /* baud rate used for downloading tracks */ +static char* opt_read_at_once = nullptr; /* number of sectors to read at once (Venus6 only) */ +static char* opt_first_sector = nullptr; /* first sector to be read from the device (default: 0) */ +static char* opt_last_sector = nullptr; /* last sector to be read from the device (default: smart read everything) */ +static char* opt_dump_file = nullptr; /* dump raw data to this file (optional) */ +static char* opt_no_output = nullptr; /* disable output? (0/1) */ +static char* opt_set_location = nullptr; /* set if the "targetlocation" options was used */ +static char* opt_configure_logging = nullptr; +static char* opt_gps_utc_offset = nullptr; static arglist_t skytraq_args[] = { @@ -78,11 +78,11 @@ arglist_t skytraq_args[] = { }, { "targetlocation", &opt_set_location, "Set location finder target location as lat,lng", - NULL, ARGTYPE_STRING, "", "", nullptr + nullptr, ARGTYPE_STRING, "", "", nullptr }, { "configlog", &opt_configure_logging, "Configure logging parameter as tmin:tmax:dmin:dmax", - NULL, ARGTYPE_STRING, "", "", nullptr + nullptr, ARGTYPE_STRING, "", "", nullptr }, { "baud", &opt_dlbaud, "Baud rate used for download", @@ -106,7 +106,7 @@ arglist_t skytraq_args[] = { }, { "dump-file", &opt_dump_file, "Dump raw data to this file", - NULL, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr }, { "no-output", &opt_no_output, "Disable output (useful with erase)", @@ -766,7 +766,7 @@ process_data_item(struct read_state* pst, const item_frame* pitem, int len) full_item f; compact_item c; multi_hz_item m; - Waypoint* tpt = NULL; + Waypoint* tpt = nullptr; switch (ITEM_TYPE(pitem)) { @@ -884,7 +884,7 @@ process_data_item(struct read_state* pst, const item_frame* pitem, int len) waypt_add(new Waypoint(*tpt)); } - if (0 == pst->route_head_) { + if (nullptr == pst->route_head_) { db(1, MYNAME ": New Track\n"); pst->route_head_ = route_head_alloc(); track_add_head(pst->route_head_); @@ -1064,8 +1064,8 @@ skytraq_read_tracks() int opt_first_sector_val = atoi(opt_first_sector); int opt_last_sector_val = atoi(opt_last_sector); int multi_read_supported = 1; - uint8_t* buffer = NULL; - gbfile* dumpfile = NULL; + uint8_t* buffer = nullptr; + gbfile* dumpfile = nullptr; state_init(&st); @@ -1307,7 +1307,7 @@ skytraq_set_location() static void skytraq_rd_init(const QString& fname) { - if ((serial_handle = gbser_init(qPrintable(fname))) == NULL) { + if ((serial_handle = gbser_init(qPrintable(fname))) == nullptr) { fatal(MYNAME ": Can't open port '%s'\n", qPrintable(fname)); } if ((skytraq_baud = skytraq_probe()) <= 0) { @@ -1319,7 +1319,7 @@ static void skytraq_rd_deinit() { gbser_deinit(serial_handle); - serial_handle = NULL; + serial_handle = nullptr; } static void @@ -1343,7 +1343,7 @@ skytraq_read() } // read device unless no-output=1 and dump-file=0 (i.e. no data needed at all) - if (*opt_no_output == '0' || opt_dump_file != NULL) { + if (*opt_no_output == '0' || opt_dump_file != nullptr) { skytraq_read_tracks(); } @@ -1361,7 +1361,7 @@ static void file_init(const QString& fname) { db(1, "Opening file...\n"); - if ((file_handle = gbfopen(fname, "rb", MYNAME)) == NULL) { + if ((file_handle = gbfopen(fname, "rb", MYNAME)) == nullptr) { fatal(MYNAME ": Can't open file '%s'\n", qPrintable(fname)); } } @@ -1371,7 +1371,7 @@ file_deinit() { db(1, "Closing file...\n"); gbfclose(file_handle); - file_handle = NULL; + file_handle = nullptr; } static void @@ -1423,12 +1423,12 @@ ff_vecs_t skytraq_vecs = { ff_cap_none /* routes */ }, skytraq_rd_init, - NULL, + nullptr, skytraq_rd_deinit, - NULL, + nullptr, skytraq_read, - NULL, - NULL, + nullptr, + nullptr, skytraq_args, CET_CHARSET_UTF8, 1 /* master process: don't convert anything */ , NULL_POS_OPS, @@ -1443,12 +1443,12 @@ ff_vecs_t skytraq_fvecs = { ff_cap_none /* routes */ }, file_init, - NULL, + nullptr, file_deinit, - NULL, + nullptr, file_read, - NULL, - NULL, + nullptr, + nullptr, skytraq_fargs, CET_CHARSET_UTF8, 1 /* master process: don't convert anything */ , NULL_POS_OPS, @@ -1464,25 +1464,25 @@ ff_vecs_t skytraq_fvecs = { #undef MYNAME #endif #define MYNAME "miniHomer" -static char* opt_set_poi_home = NULL; /* set if a "poi" option was used */ -static char* opt_set_poi_car = NULL; /* set if a "poi" option was used */ -static char* opt_set_poi_boat = NULL; /* set if a "poi" option was used */ -static char* opt_set_poi_heart = NULL; /* set if a "poi" option was used */ -static char* opt_set_poi_bar = NULL; /* set if a "poi" option was used */ +static char* opt_set_poi_home = nullptr; /* set if a "poi" option was used */ +static char* opt_set_poi_car = nullptr; /* set if a "poi" option was used */ +static char* opt_set_poi_boat = nullptr; /* set if a "poi" option was used */ +static char* opt_set_poi_heart = nullptr; /* set if a "poi" option was used */ +static char* opt_set_poi_bar = nullptr; /* set if a "poi" option was used */ arglist_t miniHomer_args[] = { { "baud", &opt_dlbaud, "Baud rate used for download", "115200", ARGTYPE_INT, "0", "115200", nullptr }, - { "dump-file", &opt_dump_file, "Dump raw data to this file", NULL, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr }, + { "dump-file", &opt_dump_file, "Dump raw data to this file", nullptr, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr }, { "erase", &opt_erase, "Erase device data after download", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "first-sector", &opt_first_sector, "First sector to be read from the device", "0", ARGTYPE_INT, "0", "65535", nullptr }, { "initbaud", &opt_initbaud, "Baud rate used to init device (0=autodetect)", "38400", ARGTYPE_INT, "38400", "38400", nullptr }, { "last-sector", &opt_last_sector, "Last sector to be read from the device (-1: smart read everything)", "-1", ARGTYPE_INT, "-1", "65535", nullptr }, { "no-output", &opt_no_output, "Disable output (useful with erase)", "0", ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "read-at-once", &opt_read_at_once, "Number of sectors to read at once (0=use single sector mode)", "255", ARGTYPE_INT, "0", "255", nullptr }, - { "Home", &opt_set_poi_home, "POI for Home Symbol as lat:lng[:alt]", NULL, ARGTYPE_STRING, "", "", nullptr }, - { "Car", &opt_set_poi_car, "POI for Car Symbol as lat:lng[:alt]", NULL, ARGTYPE_STRING, "", "", nullptr }, - { "Boat", &opt_set_poi_boat, "POI for Boat Symbol as lat:lng[:alt]", NULL, ARGTYPE_STRING, "", "", nullptr }, - { "Heart", &opt_set_poi_heart, "POI for Heart Symbol as lat:lng[:alt]", NULL, ARGTYPE_STRING, "", "", nullptr }, - { "Bar", &opt_set_poi_bar, "POI for Bar Symbol as lat:lng[:alt]", NULL, ARGTYPE_STRING, "", "", nullptr }, + { "Home", &opt_set_poi_home, "POI for Home Symbol as lat:lng[:alt]", nullptr, ARGTYPE_STRING, "", "", nullptr }, + { "Car", &opt_set_poi_car, "POI for Car Symbol as lat:lng[:alt]", nullptr, ARGTYPE_STRING, "", "", nullptr }, + { "Boat", &opt_set_poi_boat, "POI for Boat Symbol as lat:lng[:alt]", nullptr, ARGTYPE_STRING, "", "", nullptr }, + { "Heart", &opt_set_poi_heart, "POI for Heart Symbol as lat:lng[:alt]", nullptr, ARGTYPE_STRING, "", "", nullptr }, + { "Bar", &opt_set_poi_bar, "POI for Bar Symbol as lat:lng[:alt]", nullptr, ARGTYPE_STRING, "", "", nullptr }, ARG_TERMINATOR }; /* @@ -1622,7 +1622,7 @@ static QString mhport; static void miniHomer_rd_init(const QString& fname) { - opt_set_location=NULL; // otherwise it will lead to bus error + opt_set_location=nullptr; // otherwise it will lead to bus error skytraq_rd_init(fname); // sets global var serial_handle mhport=fname; } @@ -1673,12 +1673,12 @@ ff_vecs_t miniHomer_vecs = { ff_cap_none /* routes */ }, miniHomer_rd_init, - NULL, + nullptr, miniHomer_rd_deinit, - NULL, + nullptr, miniHomer_read, - NULL, - NULL, + nullptr, + nullptr, miniHomer_args, CET_CHARSET_UTF8, 1, /* master process: don't convert anything */ NULL_POS_OPS, diff --git a/smplrout.cc b/smplrout.cc index 57f3744d0..bef8bf4de 100644 --- a/smplrout.cc +++ b/smplrout.cc @@ -80,22 +80,22 @@ static arglist_t routesimple_args[] = { { "count", &countopt, "Maximum number of points in route", - NULL, ARGTYPE_INT | ARGTYPE_BEGIN_REQ | ARGTYPE_BEGIN_EXCL, "1", NULL, nullptr + nullptr, ARGTYPE_INT | ARGTYPE_BEGIN_REQ | ARGTYPE_BEGIN_EXCL, "1", nullptr, nullptr }, { - "error", &erroropt, "Maximum error", NULL, - ARGTYPE_STRING | ARGTYPE_END_REQ | ARGTYPE_END_EXCL, "0", NULL, nullptr + "error", &erroropt, "Maximum error", nullptr, + ARGTYPE_STRING | ARGTYPE_END_REQ | ARGTYPE_END_EXCL, "0", nullptr, nullptr }, { - "crosstrack", &xteopt, "Use cross-track error (default)", NULL, + "crosstrack", &xteopt, "Use cross-track error (default)", nullptr, ARGTYPE_BOOL | ARGTYPE_BEGIN_EXCL, ARG_NOMINMAX, nullptr }, { - "length", &lenopt, "Use arclength error", NULL, + "length", &lenopt, "Use arclength error", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "relative", &relopt, "Use relative error", NULL, + "relative", &relopt, "Use relative error", nullptr, ARGTYPE_BOOL | ARGTYPE_END_EXCL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR @@ -124,10 +124,10 @@ free_xte(struct xte* xte_rec) #define HUGEVAL 2000000000 -static struct xte_intermed* tmpprev = NULL; +static struct xte_intermed* tmpprev = nullptr; static int xte_count = 0; -static const route_head* cur_rte = NULL; -static struct xte* xte_recs = NULL; +static const route_head* cur_rte = nullptr; +static struct xte* xte_recs = nullptr; void routesimple_waypt_pr(const Waypoint* wpt) @@ -139,7 +139,7 @@ routesimple_waypt_pr(const Waypoint* wpt) xte_recs[xte_count].intermed = (struct xte_intermed*) xmalloc(sizeof(struct xte_intermed)); xte_recs[xte_count].intermed->wpt = wpt; xte_recs[xte_count].intermed->xte_rec = xte_recs+xte_count; - xte_recs[xte_count].intermed->next = NULL; + xte_recs[xte_count].intermed->next = nullptr; xte_recs[xte_count].intermed->prev = tmpprev; if (tmpprev) { tmpprev->next = xte_recs[xte_count].intermed; @@ -152,8 +152,8 @@ void compute_xte(struct xte* xte_rec) { const Waypoint* wpt3 = xte_rec->intermed->wpt; - const Waypoint* wpt1 = NULL; - const Waypoint* wpt2 = NULL; + const Waypoint* wpt1 = nullptr; + const Waypoint* wpt2 = nullptr; double frac, reslat, reslon; /* if no previous, this is an endpoint and must be preserved. */ if (!xte_rec->intermed->prev) { @@ -244,10 +244,10 @@ compare_xte(const void* a, const void* b) void routesimple_head(const route_head* rte) { - cur_rte = NULL; + cur_rte = nullptr; /* build array of XTE/wpt xref records */ xte_count = 0; - tmpprev = NULL; + tmpprev = nullptr; totalerror = 0; /* short-circuit if we already have fewer than the max points */ @@ -420,6 +420,6 @@ filter_vecs_t routesimple_vecs = { routesimple_init, routesimple_process, routesimple_deinit, - NULL, + nullptr, routesimple_args }; diff --git a/sort.cc b/sort.cc index c3f0c8445..6d51336d8 100644 --- a/sort.cc +++ b/sort.cc @@ -40,19 +40,19 @@ static arglist_t sort_args[] = { { "gcid", &opt_sm_gcid, "Sort by numeric geocache ID", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "shortname", &opt_sm_shortname, "Sort by waypoint short name", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "description", &opt_sm_description, "Sort by waypoint description", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "time", &opt_sm_time, "Sort by time", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -104,8 +104,8 @@ sort_init(const char*) filter_vecs_t sort_vecs = { sort_init, sort_process, - NULL, - NULL, + nullptr, + nullptr, sort_args }; #endif // FILTERS_ENABLED diff --git a/src/core/xmltag.h b/src/core/xmltag.h index 4c9a7c82e..610a2117b 100644 --- a/src/core/xmltag.h +++ b/src/core/xmltag.h @@ -19,10 +19,10 @@ class xml_tag { public: xml_tag() : - attributes(NULL), - parent(NULL), - sibling(NULL), - child(NULL) {} + attributes(nullptr), + parent(nullptr), + sibling(nullptr), + child(nullptr) {} QString tagname; QString cdata; diff --git a/stackfilter.cc b/stackfilter.cc index 50f553efe..d66f52287 100644 --- a/stackfilter.cc +++ b/stackfilter.cc @@ -27,54 +27,54 @@ #define MYNAME "Stack filter" -static char* opt_push = NULL; -static char* opt_copy = NULL; -static char* opt_pop = NULL; -static char* opt_append = NULL; -static char* opt_discard = NULL; -static char* opt_replace = NULL; -static char* opt_swap = NULL; -static char* opt_depth = NULL; -static char* nowarn = NULL; +static char* opt_push = nullptr; +static char* opt_copy = nullptr; +static char* opt_pop = nullptr; +static char* opt_append = nullptr; +static char* opt_discard = nullptr; +static char* opt_replace = nullptr; +static char* opt_swap = nullptr; +static char* opt_depth = nullptr; +static char* nowarn = nullptr; static int warnings_enabled = 1; static int swapdepth = 0; static arglist_t stackfilt_args[] = { { - "push", &opt_push, "Push waypoint list onto stack", NULL, + "push", &opt_push, "Push waypoint list onto stack", nullptr, ARGTYPE_BEGIN_EXCL | ARGTYPE_BEGIN_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "pop", &opt_pop, "Pop waypoint list from stack", NULL, + "pop", &opt_pop, "Pop waypoint list from stack", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "swap", &opt_swap, "Swap waypoint list with item on stack", - NULL, ARGTYPE_END_EXCL | ARGTYPE_END_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_END_EXCL | ARGTYPE_END_REQ | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "copy", &opt_copy, "(push) Copy waypoint list", NULL, + "copy", &opt_copy, "(push) Copy waypoint list", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { - "append", &opt_append, "(pop) Append list", NULL, + "append", &opt_append, "(pop) Append list", nullptr, ARGTYPE_BEGIN_EXCL | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "discard", &opt_discard, "(pop) Discard top of stack", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "replace", &opt_replace, "(pop) Replace list (default)", - NULL, ARGTYPE_END_EXCL | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_END_EXCL | ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "depth", &opt_depth, "(swap) Item to use (default=1)", - NULL, ARGTYPE_INT, "0", NULL, nullptr + nullptr, ARGTYPE_INT, "0", nullptr, nullptr }, { - "nowarn", &nowarn, "Suppress cleanup warning", NULL, + "nowarn", &nowarn, "Suppress cleanup warning", nullptr, ARGTYPE_BOOL | ARGTYPE_HIDDEN, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR @@ -88,15 +88,15 @@ struct stack_elt { int route_count; int track_count; struct stack_elt* next; -}* stack = NULL; +}* stack = nullptr; void stackfilt_process() { - struct stack_elt* tmp_elt = NULL; - queue* elem = NULL; - queue* tmp = NULL; + struct stack_elt* tmp_elt = nullptr; + queue* elem = nullptr; + queue* tmp = nullptr; queue tmp_queue; unsigned int tmp_count; @@ -114,7 +114,7 @@ stackfilt_process() } } - tmp = NULL; + tmp = nullptr; route_backup(&(tmp_elt->route_count), &tmp); QUEUE_MOVE(&(tmp_elt->routes), tmp); xfree(tmp); @@ -122,7 +122,7 @@ stackfilt_process() route_flush_all_routes(); } - tmp = NULL; + tmp = nullptr; track_backup(&(tmp_elt->track_count), &tmp); QUEUE_MOVE(&(tmp_elt->tracks), tmp); xfree(tmp); @@ -172,14 +172,14 @@ stackfilt_process() QUEUE_MOVE(&waypt_head, &tmp_queue); QUEUE_MOVE(&tmp_queue, &(tmp_elt->routes)); - tmp = NULL; + tmp = nullptr; route_backup(&(tmp_elt->route_count), &tmp); QUEUE_MOVE(&(tmp_elt->routes), tmp); xfree(tmp); route_restore(&tmp_queue); QUEUE_MOVE(&tmp_queue, &(tmp_elt->tracks)); - tmp = NULL; + tmp = nullptr; track_backup(&(tmp_elt->track_count), &tmp); QUEUE_MOVE(&(tmp_elt->tracks), tmp); xfree(tmp); @@ -240,7 +240,7 @@ stackfilt_deinit() void stackfilt_exit() { - struct stack_elt* tmp_elt = NULL; + struct stack_elt* tmp_elt = nullptr; if (warnings_enabled && stack) { warning(MYNAME " Warning: leftover stack entries; " diff --git a/stmsdf.cc b/stmsdf.cc index 69c777262..eca3ca2a8 100644 --- a/stmsdf.cc +++ b/stmsdf.cc @@ -95,7 +95,7 @@ static arglist_t stmsdf_args[] = { { "index", &opt_route_index, - "Index of route (if more than one in source)", "1", ARGTYPE_INT, "1", NULL, nullptr + "Index of route (if more than one in source)", "1", ARGTYPE_INT, "1", nullptr, nullptr }, ARG_TERMINATOR }; @@ -107,12 +107,12 @@ static void parse_header(char* line) { char* str; - char* key = NULL; - const char* prod = NULL; + char* key = nullptr; + const char* prod = nullptr; int column = -1; while ((str = csv_lineparse(line, "=", "", lineno))) { - line = NULL; + line = nullptr; column++; switch (column) { @@ -149,7 +149,7 @@ parse_header(char* line) break; default: - if (prod == NULL) { + if (prod == nullptr) { prod = "unknown"; } fatal(MYNAME ": Unsupported file type (%s, type %d)!\n", prod, filetype); @@ -180,7 +180,7 @@ finalize_tracks(void) int count = 0; queue* elem, *tmp; int index; - route_head* track = NULL; + route_head* track = nullptr; int trackno = 0; count = 0; @@ -205,26 +205,26 @@ finalize_tracks(void) for (index = 0; index < count; index++) { Waypoint* wpt = list[index]; if (wpt->wpt_flags.fmt_use == 2) { /* log continued */ - track = NULL; + track = nullptr; } - if (track == NULL) { + if (track == nullptr) { track = route_head_alloc(); track_add_head(track); trackno++; - if (rte_name != NULL) { + if (rte_name != nullptr) { if (trackno > 1) { track->rte_name = QString("%1 (%2)").arg(rte_name).arg(trackno); } else { track->rte_name = rte_name; } } - if (rte_desc != NULL) { + if (rte_desc != nullptr) { track->rte_desc = rte_desc; } } track_add_wpt(track, wpt); if (wpt->wpt_flags.fmt_use == 1) { /* log pause */ - track = NULL; + track = nullptr; } wpt->wpt_flags.fmt_use = 0; } @@ -238,7 +238,7 @@ parse_point(char* line) char* str; int column = -1; int what = -1; /* -1 = unknown, 0 = tp, 1 = mp, 2 = wp, 3 = ap */ - Waypoint* wpt = NULL; + Waypoint* wpt = nullptr; char* cx; int hour, min, sec, day, month, year; @@ -246,7 +246,7 @@ parse_point(char* line) while ((str = csv_lineparse(line, ",", "", lineno))) { - line = NULL; + line = nullptr; column++; switch (column) { @@ -347,7 +347,7 @@ parse_point(char* line) break; case 2: case 3: - if (route == NULL) { + if (route == nullptr) { route = route_head_alloc(); route_add_head(route); } @@ -364,7 +364,7 @@ rd_init(const QString& fname) fin = gbfopen(fname, "r", MYNAME); lineno = 0; - route = NULL; + route = nullptr; datum = DATUM_WGS84; filetype = 28; rte_name = rte_desc = QString(); @@ -399,11 +399,11 @@ data_read(void) if (*cin == '[') { char* cend = strchr(++cin, ']'); - if (cend != NULL) { + if (cend != nullptr) { *cend = '\0'; cin = lrtrim(cin); } - if ((*cin == '\0') || (cend == NULL)) { + if ((*cin == '\0') || (cend == nullptr)) { fatal(MYNAME ": Invalid section header!\n"); } @@ -437,7 +437,7 @@ static void calculate(const Waypoint* wpt, double* dist, double* speed, double* course, double* asc, double* desc) { - if (trkpt_out != NULL) { + if (trkpt_out != nullptr) { time_t time; @@ -493,7 +493,7 @@ static void any_hdr_calc_cb(const route_head* trk) { - trkpt_out = NULL; + trkpt_out = nullptr; this_distance = 0; this_time = 0; this_points = 0; @@ -540,7 +540,7 @@ any_waypt_calc_cb(const Waypoint* wpt) } this_distance = this_distance + dist; - if (trkpt_out != NULL) { + if (trkpt_out != nullptr) { this_time += (wpt->GetCreationTime().toTime_t() - trkpt_out->GetCreationTime().toTime_t()); } @@ -567,7 +567,7 @@ track_disp_hdr_cb(const route_head* trk) track_index++; track_points = 0; trk_out = (route_head*)trk; - trkpt_out = NULL; + trkpt_out = nullptr; } @@ -586,7 +586,7 @@ track_disp_wpt_cb(const Waypoint* wpt) tm = *localtime(&ct); strftime(tbuf, sizeof(tbuf), "%d.%m.%Y,%H:%M.%S", &tm); - calculate(wpt, &dist, &speed, &course, NULL, NULL); + calculate(wpt, &dist, &speed, &course, nullptr, nullptr); trkpt_dist = trkpt_dist + dist; if (track_points == trk_out->rte_waypt_ct) { /* I'm the last in that list */ @@ -601,13 +601,13 @@ track_disp_wpt_cb(const Waypoint* wpt) if (flag == 1) { QString name = wpt->shortname; - if (name == NULL) { + if (name == nullptr) { name = "Log paused"; } gbfprintf(fout, "\"MP\",\"%s\"", CSTR(name)); } else if (flag == 2) { QString name = wpt->shortname; - if (name == NULL) { + if (name == nullptr) { name = "Log continued"; } gbfprintf(fout, "\"MP\",\"%s\"", CSTR(name)); @@ -636,7 +636,7 @@ track_disp_wpt_cb(const Waypoint* wpt) static void track_disp_tlr_cb(const route_head*) { - trkpt_out = NULL; + trkpt_out = nullptr; } static void @@ -694,7 +694,7 @@ data_write(void) rte_name = QString(); rte_desc = QString(); - trkpt_out = NULL; + trkpt_out = nullptr; opt_route_index_value = -1; /* take all tracks from data pool */ track_index = 0; minalt = -unknown_alt; @@ -731,7 +731,7 @@ data_write(void) gbfprintf(fout, "[POINTS]\n"); if (route_points > 0) { track_index = 0; - route_disp_all(route_disp_hdr_cb, NULL, route_disp_wpt_cb); + route_disp_all(route_disp_hdr_cb, nullptr, route_disp_wpt_cb); } break; @@ -777,7 +777,7 @@ data_write(void) if (start_time) { gbfprintf(fout, "[CUSTOM1]\n"); track_index = 0; - track_disp_all(NULL, NULL, track_disp_custom_cb); + track_disp_all(nullptr, nullptr, track_disp_custom_cb); } } break; @@ -802,7 +802,7 @@ ff_vecs_t stmsdf_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, stmsdf_args, CET_CHARSET_MS_ANSI, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/stmwpp.cc b/stmwpp.cc index 8f9a37cc5..55a588024 100644 --- a/stmwpp.cc +++ b/stmwpp.cc @@ -47,13 +47,13 @@ static int track_index; static int track_num; static int what; -static char* index_opt = NULL; +static char* index_opt = nullptr; static arglist_t stmwpp_args[] = { { "index", &index_opt, "Index of route/track to write (if more than one in source)", - NULL, ARGTYPE_INT, "1", NULL, nullptr + nullptr, ARGTYPE_INT, "1", nullptr, nullptr }, ARG_TERMINATOR }; @@ -63,9 +63,9 @@ static void stmwpp_rd_init(const QString& fname) { fin = gbfopen(fname, "rb", MYNAME); - track = NULL; - route = NULL; - wpt = NULL; + track = nullptr; + route = nullptr; + wpt = nullptr; } static void @@ -82,7 +82,7 @@ stmwpp_data_read(void) what = STM_NOTHING; buff = gbfgetstr(fin); - buff = (buff == NULL) ? (char*) "" : buff; + buff = (buff == nullptr) ? (char*) "" : buff; if (case_ignore_strncmp(buff, "Datum,WGS 84,WGS 84,", 20) != 0) { fatal(MYNAME ": Invalid GPS datum or not \"WaypointPlus\"\" file!\n"); @@ -102,14 +102,14 @@ stmwpp_data_read(void) continue; } - wpt = NULL; + wpt = nullptr; memset(&time, 0, sizeof(time)); int milliseconds = 0; while ((c = csv_lineparse(buff, ",", "", column++))) { int new_what; - buff = NULL; + buff = nullptr; switch (column) { case 0: @@ -163,7 +163,7 @@ stmwpp_data_read(void) break; } } - if (wpt != NULL) { + if (wpt != nullptr) { time.tm_year -= 1900; time.tm_mon--; wpt->SetCreationTime(mkgmtime(&time), milliseconds); @@ -172,7 +172,7 @@ stmwpp_data_read(void) case STM_WAYPT: waypt_add(wpt); if (global_opts.objective == rtedata) { - if (route == NULL) { + if (route == nullptr) { route = route_head_alloc(); route_add_head(route); } @@ -181,14 +181,14 @@ stmwpp_data_read(void) break; case STM_TRKPT: - if (track == NULL) { + if (track == nullptr) { track = route_head_alloc(); track_add_head(track); } track_add_wpt(track, wpt); break; } - wpt = NULL; + wpt = nullptr; } } } @@ -290,7 +290,7 @@ stmwpp_data_write(void) setshort_repeating_whitespace_ok(short_h, 1); track_num = 0; - if (index_opt != NULL) { + if (index_opt != nullptr) { track_index = atoi(index_opt); } else { track_index = 1; @@ -309,11 +309,11 @@ stmwpp_data_write(void) case rtedata: what = STM_RTEPT; setshort_defname(short_h, "RPT"); - route_disp_all(stmwpp_track_hdr, NULL, stmwpp_waypt_cb); + route_disp_all(stmwpp_track_hdr, nullptr, stmwpp_waypt_cb); break; case trkdata: what = STM_TRKPT; - track_disp_all(stmwpp_track_hdr, NULL, stmwpp_waypt_cb); + track_disp_all(stmwpp_track_hdr, nullptr, stmwpp_waypt_cb); break; case posndata: fatal(MYNAME ": Realtime positioning not supported.\n"); @@ -330,7 +330,7 @@ ff_vecs_t stmwpp_vecs = { stmwpp_rw_deinit, stmwpp_data_read, stmwpp_data_write, - NULL, + nullptr, stmwpp_args, CET_CHARSET_MS_ANSI, 0 , NULL_POS_OPS, diff --git a/subrip.cc b/subrip.cc index 85d3d0ff0..61bc2fffd 100644 --- a/subrip.cc +++ b/subrip.cc @@ -204,11 +204,11 @@ subrip_wr_init(const QString& fname) time_offset = 0; - prevwpp = NULL; + prevwpp = nullptr; vspeed = 0; gradient = 0; - if ((opt_gpstime != NULL) && (opt_gpsdate != NULL)) { + if ((opt_gpstime != nullptr) && (opt_gpsdate != nullptr)) { time(&gpstime_t); ptm_gps = gmtime(&gpstime_t); if (opt_gpstime) { @@ -249,14 +249,14 @@ subrip_wr_deinit() static void subrip_write() { - track_disp_all(NULL, NULL, subrip_trkpt_pr); + track_disp_all(nullptr, nullptr, subrip_trkpt_pr); /* * Due to the necessary hack, one waypoint is still in memory (unless we * did not get any waypoints). Check if there is one and, if so, write it. */ if (prevwpp) { - subrip_prevwp_pr(NULL); + subrip_prevwp_pr(nullptr); } } @@ -264,9 +264,9 @@ subrip_write() arglist_t subrip_args[] = { // FIXME: document that gps_date and gps_time must be specified together or they will both be ignored and the timestamp of the first trackpoint will be used. - {"video_time", &opt_videotime, "Video position for which exact GPS time is known (hhmmss, default is 0:00:00)", 0, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, - {"gps_time", &opt_gpstime, "GPS time at position video_time (hhmmss, default is first timestamp of track)", 0, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, - {"gps_date", &opt_gpsdate, "GPS date at position video_time (hhmmss, default is first timestamp of track)", 0, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + {"video_time", &opt_videotime, "Video position for which exact GPS time is known (hhmmss, default is 0:00:00)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + {"gps_time", &opt_gpstime, "GPS time at position video_time (hhmmss, default is first timestamp of track)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, + {"gps_date", &opt_gpsdate, "GPS date at position video_time (hhmmss, default is first timestamp of track)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, {"format", &opt_format, "Format for subtitles", "%s km/h %e m\\n%t %l", ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -276,13 +276,13 @@ arglist_t subrip_args[] = { ff_vecs_t subrip_vecs = { ff_type_file, { ff_cap_none, ff_cap_write, ff_cap_none }, // waypoints, track, route; for now, we just do tracks - NULL, + nullptr, subrip_wr_init, - NULL, + nullptr, subrip_wr_deinit, - NULL, + nullptr, subrip_write, - NULL, + nullptr, subrip_args, CET_CHARSET_ASCII, 0 , NULL_POS_OPS, diff --git a/swapdata.cc b/swapdata.cc index 209442bc9..d0ce2d3cb 100644 --- a/swapdata.cc +++ b/swapdata.cc @@ -53,17 +53,17 @@ static void swapdata_process(void) /* this procedure must be present in vecs */ { waypt_disp_all(swapdata_cb); - route_disp_all(NULL, NULL, swapdata_cb); - track_disp_all(NULL, NULL, swapdata_cb); + route_disp_all(nullptr, nullptr, swapdata_cb); + track_disp_all(nullptr, nullptr, swapdata_cb); } /*******************************************************************************/ filter_vecs_t swapdata_vecs = { - NULL, + nullptr, swapdata_process, - NULL, - NULL, + nullptr, + nullptr, swapdata_args }; diff --git a/tef_xml.cc b/tef_xml.cc index 6f85075ce..1ec6f8e55 100644 --- a/tef_xml.cc +++ b/tef_xml.cc @@ -32,14 +32,14 @@ static Waypoint* wpt_tmp; static int item_count; static int waypoints; static double version; -static route_head* route = NULL; +static route_head* route = nullptr; -static char* routevia = NULL; +static char* routevia = nullptr; static arglist_t tef_xml_args[] = { { "routevia", &routevia, "Include only via stations in route", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -58,7 +58,7 @@ xg_tag_mapping tef_xml_map[] = { { tef_point, cb_start, "/TEF/WaypointList/Item/Point" }, { tef_item_end, cb_end, "/TEF/WaypointList/Item" }, { tef_list_end, cb_end, "/TEF/WaypointList" }, - { NULL, (xg_cb_type)0, NULL } + { nullptr, (xg_cb_type)0, nullptr } }; @@ -187,7 +187,7 @@ static void waypoint_final() { int via; - if (wpt_tmp == NULL) { + if (wpt_tmp == nullptr) { return; } @@ -205,8 +205,8 @@ waypoint_final() waypt_add(wpt_tmp); } - if (route != NULL) { - if ((via != 0) || (routevia == NULL)) { + if (route != nullptr) { + if ((via != 0) || (routevia == nullptr)) { Waypoint* wpt = new Waypoint(*wpt_tmp); route_add_wpt(route, wpt); } @@ -216,7 +216,7 @@ waypoint_final() delete wpt_tmp; } - wpt_tmp = NULL; + wpt_tmp = nullptr; } static void @@ -301,12 +301,12 @@ tef_point(xg_string, const QXmlStreamAttributes* attrv) static void tef_xml_rd_init(const QString& fname) { - wpt_tmp = NULL; + wpt_tmp = nullptr; waypoints = 0; item_count = -1; version = 1.5; - xml_init(fname, tef_xml_map, NULL); + xml_init(fname, tef_xml_map, nullptr); } static void @@ -325,12 +325,12 @@ ff_vecs_t tef_xml_vecs = { ff_type_file, { ff_cap_none, ff_cap_none, ff_cap_read }, tef_xml_rd_init, - NULL, + nullptr, tef_xml_rd_deinit, - NULL, + nullptr, tef_xml_read, - NULL, - NULL, + nullptr, + nullptr, tef_xml_args, CET_CHARSET_UTF8, 1 , NULL_POS_OPS, diff --git a/teletype.cc b/teletype.cc index f789981ed..d0b2839ff 100644 --- a/teletype.cc +++ b/teletype.cc @@ -108,11 +108,11 @@ ff_vecs_t teletype_vecs = { ff_cap_none /* routes */ }, teletype_rd_init, - NULL, + nullptr, teletype_rd_deinit, - NULL, + nullptr, teletype_read, - NULL, + nullptr, teletype_exit, teletype_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ diff --git a/text.cc b/text.cc index 493c1fbe1..962034361 100644 --- a/text.cc +++ b/text.cc @@ -29,12 +29,12 @@ static gbfile* file_out; static short_handle mkshort_handle; -static char* suppresssep = NULL; -static char* txt_encrypt = NULL; -static char* includelogs = NULL; -static char* degformat = NULL; -static char* altunits = NULL; -static char* split_output = NULL; +static char* suppresssep = nullptr; +static char* txt_encrypt = nullptr; +static char* includelogs = nullptr; +static char* degformat = nullptr; +static char* altunits = nullptr; +static char* split_output = nullptr; static int waypoint_count; static QString output_name; @@ -45,15 +45,15 @@ arglist_t text_args[] = { { "nosep", &suppresssep, "Suppress separator lines between waypoints", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "encrypt", &txt_encrypt, - "Encrypt hints using ROT13", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + "Encrypt hints using ROT13", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "logs", &includelogs, - "Include groundspeak logs if present", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + "Include groundspeak logs if present", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "degformat", °format, @@ -65,7 +65,7 @@ arglist_t text_args[] = { }, { "splitoutput", &split_output, - "Write each waypoint in a separate file", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + "Write each waypoint in a separate file", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR @@ -167,19 +167,19 @@ text_disp(const Waypoint* wpt) gbfputs("\n", file_out); } - fs_gpx = NULL; + fs_gpx = nullptr; if (includelogs) { fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX); } if (fs_gpx && fs_gpx->tag) { xml_tag* root = fs_gpx->tag; - xml_tag* curlog = NULL; - xml_tag* logpart = NULL; + xml_tag* curlog = nullptr; + xml_tag* logpart = nullptr; curlog = xml_findfirst(root, "groundspeak:log"); while (curlog) { time_t logtime = 0; - struct tm* logtm = NULL; + struct tm* logtm = nullptr; gbfprintf(file_out, "\n"); logpart = xml_findfirst(curlog, "groundspeak:type"); @@ -209,7 +209,7 @@ text_disp(const Waypoint* wpt) logpart = xml_findfirst(curlog, "groundspeak:log_wpt"); if (logpart) { - char* coordstr = NULL; + char* coordstr = nullptr; double lat = 0; double lon = 0; coordstr = xml_attribute(logpart, "lat"); @@ -227,7 +227,7 @@ text_disp(const Waypoint* wpt) logpart = xml_findfirst(curlog, "groundspeak:text"); if (logpart) { - char* encstr = NULL; + char* encstr = nullptr; int encoded = 0; encstr = xml_attribute(logpart, "encoded"); encoded = (toupper(encstr[0]) != 'F'); @@ -254,7 +254,7 @@ text_disp(const Waypoint* wpt) if (split_output) { gbfclose(file_out); - file_out = NULL; + file_out = nullptr; } } @@ -272,13 +272,13 @@ data_write() ff_vecs_t text_vecs = { ff_type_file, { ff_cap_write, ff_cap_none, ff_cap_none}, - NULL, + nullptr, wr_init, - NULL, + nullptr, wr_deinit, - NULL, + nullptr, data_write, - NULL, + nullptr, text_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/tiger.cc b/tiger.cc index ea5f2386e..d7b1fc87b 100644 --- a/tiger.cc +++ b/tiger.cc @@ -34,19 +34,19 @@ static short_handle mkshort_whandle; static double maxlat, maxlon, minlat, minlon; static int rec_cnt; -static char* nolabels = NULL; -static char* genurl = NULL; -static char* suppresswhite = NULL; -static char* iconismarker = NULL; -static char* snlen = NULL; - -static char* margin = NULL; -static char* xpixels = NULL; -static char* ypixels = NULL; -static char* oldthresh = NULL; -static char* oldmarker = NULL; -static char* newmarker = NULL; -static char* unfoundmarker = NULL; +static char* nolabels = nullptr; +static char* genurl = nullptr; +static char* suppresswhite = nullptr; +static char* iconismarker = nullptr; +static char* snlen = nullptr; + +static char* margin = nullptr; +static char* xpixels = nullptr; +static char* ypixels = nullptr; +static char* oldthresh = nullptr; +static char* oldmarker = nullptr; +static char* newmarker = nullptr; +static char* unfoundmarker = nullptr; static int short_length; static double thresh_days; @@ -66,11 +66,11 @@ static arglist_t tiger_args[] = { { "nolabels", &nolabels, "Suppress labels on generated pins", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "genurl", &genurl, "Generate file with lat/lon for centering map", - NULL, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_OUTFILE, ARG_NOMINMAX, nullptr }, { "margin", &margin, "Margin for map. Degrees or percentage", @@ -78,7 +78,7 @@ arglist_t tiger_args[] = { }, { "snlen", &snlen, "Max shortname length when used with -s", - "10", ARGTYPE_INT, "1", NULL, nullptr + "10", ARGTYPE_INT, "1", nullptr, nullptr }, { "oldthresh", &oldthresh, @@ -96,7 +96,7 @@ arglist_t tiger_args[] = { { "suppresswhite", &suppresswhite, "Suppress whitespace in generated shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "unfoundmarker", &unfoundmarker, "Marker type for unfound points", @@ -112,7 +112,7 @@ arglist_t tiger_args[] = { }, { "iconismarker", &iconismarker, - "The icon description is already the marker", NULL, + "The icon description is already the marker", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, #if CLICKMAP @@ -143,7 +143,7 @@ static void wr_init(const QString& fname) { file_out = gbfopen(fname, "w", MYNAME); - thresh_days = strtod(oldthresh, NULL); + thresh_days = strtod(oldthresh, nullptr); } static void @@ -221,7 +221,7 @@ tiger_disp(const Waypoint* wpt) desc = mkshort(mkshort_whandle, desc); } gbfprintf(file_out, ":%s", CSTR(desc)); - if (temp != NULL) { + if (temp != nullptr) { desc = temp; } } @@ -254,9 +254,9 @@ dscale(double distance) */ if (strchr(margin, '%')) { - return distance + strtod(margin, NULL) / 100.0 * distance; + return distance + strtod(margin, nullptr) / 100.0 * distance; } else { - return strtod(margin, NULL) + distance; + return strtod(margin, nullptr) + distance; } } @@ -326,7 +326,7 @@ ff_vecs_t tiger_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, tiger_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/tmpro.cc b/tmpro.cc index 1bcf30781..bd4afe43b 100644 --- a/tmpro.cc +++ b/tmpro.cc @@ -81,7 +81,7 @@ data_read() } /* skip the line if it contains "sHyperLink" as it is a header (I hope :) */ - if ((strlen(buff)) && (strstr(buff, "sHyperLink") == NULL)) { + if ((strlen(buff)) && (strstr(buff, "sHyperLink") == nullptr)) { wpt_tmp = new Waypoint; @@ -151,7 +151,7 @@ data_read() } i++; - s = csv_lineparse(NULL, "\t", "\"", linecount); + s = csv_lineparse(nullptr, "\t", "\"", linecount); } if (i != 11) { @@ -206,7 +206,7 @@ tmpro_waypt_pr(const Waypoint* wpt) /* Number of characters */ /* 25 6 80 8 8 8 8 8 4 4 128 */ - const char* l = NULL; + const char* l = nullptr; if (wpt->HasUrlLink()) { // Yes, it's lame to allocate/copy here. UrlLink link = wpt->GetUrlLink(); @@ -255,8 +255,8 @@ ff_vecs_t tmpro_vecs = { wr_deinit, data_read, data_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/tomtom.cc b/tomtom.cc index c7b07f5c9..68485c861 100644 --- a/tomtom.cc +++ b/tomtom.cc @@ -200,7 +200,7 @@ data_read() wpt_tmp->latitude = y/100000.0; wpt_tmp->description = STRTOUNICODE(desc); xfree(desc); - desc = NULL; + desc = nullptr; // TODO:: description in rectype 3 contains two zero-terminated strings // First is same as rectype 2, second apparently contains the unique ID of the waypoint // See http://www.tomtom.com/lib/doc/PRO/TTN6_SDK_documentation.zip @@ -371,7 +371,7 @@ compute_blocks(struct hdr* start, int count, newblock->size = 4 * 5 + 1; /* hdr is 5 longs, 1 char */ if (count < 20) { int i; - Waypoint* wpt = NULL; + Waypoint* wpt = nullptr; for (i = 0; i < count; i++) { newblock->size += 4 * 3 + 1; @@ -436,7 +436,7 @@ data_write() double maxlon = -200; double minlat = 200; double maxlat = -200; - struct blockheader* blocks = NULL; + struct blockheader* blocks = nullptr; htable = (struct hdr*) xmalloc(ct * sizeof(*htable)); bh = htable; @@ -480,7 +480,7 @@ ff_vecs_t tomtom_vecs = { wr_deinit, data_read, data_write, - NULL, + nullptr, tomtom_args, CET_CHARSET_MS_ANSI, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/tpg.cc b/tpg.cc index f9ed3630c..fa80c4999 100644 --- a/tpg.cc +++ b/tpg.cc @@ -319,7 +319,7 @@ ff_vecs_t tpg_vecs = { tpg_wr_deinit, tpg_read, tpg_write, - NULL, + nullptr, tpg_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/tpo.cc b/tpo.cc index d8dbddc66..d2901e9ec 100644 --- a/tpo.cc +++ b/tpo.cc @@ -81,8 +81,8 @@ #define MYNAME "TPO" -static char* dumpheader = NULL; -static char* output_state = NULL; +static char* dumpheader = nullptr; +static char* output_state = nullptr; /* static @@ -1359,7 +1359,7 @@ tpo_rd_init(const QString& fname) // preprare for an attempt to deallocate memory that may or may not get allocated // depending on the options used. tpo_index_ptr = 0; - tpo_wp_index = NULL; + tpo_wp_index = nullptr; tpo_file_in = gbfopen_le(fname, "rb", MYNAME); tpo_check_version_string(); @@ -1396,7 +1396,7 @@ tpo_rd_deinit() // Free the index array itself if (tpo_wp_index) { xfree(tpo_wp_index); - tpo_wp_index = NULL; + tpo_wp_index = nullptr; } gbfclose(tpo_file_in); @@ -1894,7 +1894,7 @@ ff_vecs_t tpo2_vecs = { tpo_wr_deinit, tpo_read, tpo_write, - NULL, + nullptr, tpo2_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, @@ -1911,7 +1911,7 @@ ff_vecs_t tpo3_vecs = { tpo_wr_deinit, tpo_read, tpo_write, - NULL, + nullptr, tpo3_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/trackfilter.cc b/trackfilter.cc index 40ff8f302..e87295867 100644 --- a/trackfilter.cc +++ b/trackfilter.cc @@ -56,112 +56,112 @@ #undef TRACKF_DBG -static char* opt_merge = NULL; -static char* opt_pack = NULL; -static char* opt_split = NULL; -static char* opt_sdistance = NULL; -static char* opt_move = NULL; -static char* opt_title = NULL; -static char* opt_start = NULL; -static char* opt_stop = NULL; -static char* opt_fix = NULL; -static char* opt_course = NULL; -static char* opt_speed = NULL; -static char* opt_name = NULL; -static char* opt_seg2trk = NULL; -static char* opt_trk2seg = NULL; -static char* opt_segment = NULL; -static char* opt_faketime = NULL; -static char* opt_discard = NULL; -static char* opt_minpoints = NULL; +static char* opt_merge = nullptr; +static char* opt_pack = nullptr; +static char* opt_split = nullptr; +static char* opt_sdistance = nullptr; +static char* opt_move = nullptr; +static char* opt_title = nullptr; +static char* opt_start = nullptr; +static char* opt_stop = nullptr; +static char* opt_fix = nullptr; +static char* opt_course = nullptr; +static char* opt_speed = nullptr; +static char* opt_name = nullptr; +static char* opt_seg2trk = nullptr; +static char* opt_trk2seg = nullptr; +static char* opt_segment = nullptr; +static char* opt_faketime = nullptr; +static char* opt_discard = nullptr; +static char* opt_minpoints = nullptr; static arglist_t trackfilter_args[] = { { TRACKFILTER_MOVE_OPTION, &opt_move, - "Correct trackpoint timestamps by a delta", NULL, ARGTYPE_STRING, + "Correct trackpoint timestamps by a delta", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_PACK_OPTION, &opt_pack, - "Pack all tracks into one", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + "Pack all tracks into one", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { TRACKFILTER_SPLIT_OPTION, &opt_split, - "Split by date or time interval (see README)", NULL, + "Split by date or time interval (see README)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_SDIST_OPTION, &opt_sdistance, - "Split by distance", NULL, + "Split by distance", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_MERGE_OPTION, &opt_merge, - "Merge multiple tracks for the same way", NULL, ARGTYPE_STRING, + "Merge multiple tracks for the same way", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_NAME_OPTION, &opt_name, - "Use only track(s) where title matches given name", NULL, ARGTYPE_STRING, + "Use only track(s) where title matches given name", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_START_OPTION, &opt_start, - "Use only track points after this timestamp", NULL, ARGTYPE_INT, + "Use only track points after this timestamp", nullptr, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, { TRACKFILTER_STOP_OPTION, &opt_stop, - "Use only track points before this timestamp", NULL, ARGTYPE_INT, + "Use only track points before this timestamp", nullptr, ARGTYPE_INT, ARG_NOMINMAX, nullptr }, { TRACKFILTER_TITLE_OPTION, &opt_title, - "Basic title for new track(s)", NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + "Basic title for new track(s)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_FIX_OPTION, &opt_fix, - "Synthesize GPS fixes (PPS, DGPS, 3D, 2D, NONE)", NULL, + "Synthesize GPS fixes (PPS, DGPS, 3D, 2D, NONE)", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_COURSE_OPTION, &opt_course, "Synthesize course", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { TRACKFILTER_SPEED_OPTION, &opt_speed, "Synthesize speed", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { TRACKFILTER_SEG2TRK_OPTION, &opt_seg2trk, "Split track at segment boundaries into multiple tracks", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { TRACKFILTER_TRK2SEG_OPTION, &opt_trk2seg, "Merge tracks inserting segment separators at boundaries", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { TRACKFILTER_SEGMENT_OPTION, &opt_segment, "segment tracks with abnormally long gaps", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { TRACKFILTER_FAKETIME_OPTION, &opt_faketime, "Add specified timestamp to each trackpoint", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { TRACKFILTER_DISCARD_OPTION, &opt_discard, "Discard track points without timestamps during merge", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { TRACKFILTER_MINPOINTS_OPTION, &opt_minpoints, "Discard tracks with fewer than these points", - NULL, ARGTYPE_INT, "0", "50", nullptr + nullptr, ARGTYPE_INT, "0", "50", nullptr }, ARG_TERMINATOR }; @@ -173,7 +173,7 @@ typedef struct trkflt_s { QDateTime last_time; } trkflt_t; -static trkflt_t* track_list = NULL; +static trkflt_t* track_list = nullptr; static int track_ct = 0; static int track_pts = 0; static int timeless_pts = 0; @@ -192,7 +192,7 @@ trackfilter_opt_count() arglist_t* a = trackfilter_args; while (a->argstring) { - if (*a->argval != NULL) { + if (*a->argval != nullptr) { res++; } a++; @@ -331,7 +331,7 @@ trackfilter_fill_track_list_cb(const route_head* track) /* callback for track_d return; } - if (opt_name != NULL) { + if (opt_name != nullptr) { if (!QRegExp(opt_name, Qt::CaseInsensitive, QRegExp::WildcardUnix).exactMatch(track->rte_name)) { QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { Waypoint* wpt = (Waypoint*)elem; @@ -346,7 +346,7 @@ trackfilter_fill_track_list_cb(const route_head* track) /* callback for track_d track_list[track_ct].track = (route_head*)track; i = 0; - prev = NULL; + prev = nullptr; QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { track_pts++; @@ -367,8 +367,8 @@ trackfilter_fill_track_list_cb(const route_head* track) /* callback for track_d track_list[track_ct].last_time = wpt->GetCreationTime(); } - if ((need_time != 0) && (prev != NULL) && (prev->GetCreationTime() > wpt->GetCreationTime())) { - if (opt_merge == NULL) { + if ((need_time != 0) && (prev != nullptr) && (prev->GetCreationTime() > wpt->GetCreationTime())) { + if (opt_merge == nullptr) { QString t1 = prev->CreationTimeXML(); QString t2 = wpt->CreationTimeXML(); fatal(MYNAME "-init: Track points badly ordered (timestamp %s > %s)!\n", qPrintable(t1), qPrintable(t2)); @@ -404,8 +404,8 @@ trackfilter_split_init_rte_name(route_head* track, const QDateTime dt) datetimestring = dt.toUTC().toString("yyyyMMdd"); } - if ((opt_title != NULL) && (strlen(opt_title) > 0)) { - if (strchr(opt_title, '%') != NULL) { + if ((opt_title != nullptr) && (strlen(opt_title) > 0)) { + if (strchr(opt_title, '%') != nullptr) { // Uggh. strftime format exposed to user. char buff[128]; @@ -427,7 +427,7 @@ trackfilter_split_init_rte_name(route_head* track, const QDateTime dt) static void trackfilter_pack_init_rte_name(route_head* track, const time_t default_time) { - if (strchr(opt_title, '%') != NULL) { + if (strchr(opt_title, '%') != nullptr) { struct tm tm; Waypoint* wpt; @@ -455,7 +455,7 @@ trackfilter_title() { int i; - if (opt_title == NULL) { + if (opt_title == nullptr) { return; } @@ -502,7 +502,7 @@ trackfilter_pack() track_add_wpt(master, wpt); } track_del_head(curr); - track_list[i].track = NULL; + track_list[i].track = nullptr; } track_ct = 1; } @@ -556,12 +556,12 @@ trackfilter_merge() qsort(buff, track_pts-timeless_pts, sizeof(*buff), trackfilter_merge_qsort_cb); dropped = timeless_pts; - prev = NULL; + prev = nullptr; for (i = 0; i < track_pts-timeless_pts; i++) { - buff[i]->extra_data = NULL; + buff[i]->extra_data = nullptr; wpt = buff[i]; - if ((prev == NULL) || (prev->GetCreationTime() != wpt->GetCreationTime())) { + if ((prev == nullptr) || (prev->GetCreationTime() != wpt->GetCreationTime())) { track_add_wpt(master, wpt); prev = wpt; } else { @@ -705,7 +705,7 @@ trackfilter_split() buff[i++] = wpt; } - curr = NULL; /* will be set by first new track */ + curr = nullptr; /* will be set by first new track */ for (i=0, j=1; jGetCreationTime()); track_add_head(curr); } - if (curr != NULL) { + if (curr != nullptr) { wpt = buff[j]; track_del_wpt(master, wpt); track_add_wpt(curr, wpt); @@ -918,7 +918,7 @@ trackfilter_range_check(const char* timestr) fmt[i++] = c; } cin = strptime(fmt, "%Y%m%d%H%M%S", &time); - if ((cin != NULL) && (*cin != '\0')) { + if ((cin != nullptr) && (*cin != '\0')) { fatal(MYNAME "-range-check: Invalid time stamp (stopped at %s of %s)!\n", cin, fmt); } @@ -932,13 +932,13 @@ trackfilter_range() /* returns number of track points left after filtering */ queue* elem, *tmp; int i, dropped, inside = 0; - if (opt_start != 0) { + if (opt_start != nullptr) { start = trackfilter_range_check(opt_start); } else { start = 0; } - if (opt_stop != 0) { + if (opt_stop != nullptr) { stop = trackfilter_range_check(opt_stop); } else { stop = 0x7FFFFFFF; @@ -969,7 +969,7 @@ trackfilter_range() /* returns number of track points left after filtering */ if (track->rte_waypt_ct == 0) { track_del_head(track); - track_list[i].track = NULL; + track_list[i].track = nullptr; } } @@ -992,7 +992,7 @@ trackfilter_seg2trk() for (i = 0; i < track_ct; i++) { queue* elem, *tmp; route_head* src = track_list[i].track; - route_head* dest = NULL; + route_head* dest = nullptr; route_head* insert_point = src; int trk_seg_num = 1, first = 1; @@ -1062,7 +1062,7 @@ trackfilter_trk2seg() } } track_del_head(curr); - track_list[i].track = NULL; + track_list[i].track = nullptr; } track_ct = 1; } @@ -1126,7 +1126,7 @@ trackfilter_faketime_check(const char* timestr) cin = strptime(fmtstart, "%Y%m%d%H%M%S", &time); result.step = atoi(fmtstep); - if ((cin != NULL) && (*cin != '\0')) { + if ((cin != nullptr) && (*cin != '\0')) { fatal(MYNAME "-faketime-check: Invalid time stamp (stopped at %s of %s)!\n", cin, fmtstart); } @@ -1142,7 +1142,7 @@ trackfilter_faketime() /* returns number of track points left after queue* elem, *tmp; int i, dropped, inside = 0; - if (opt_faketime != 0) { + if (opt_faketime != nullptr) { faketime = trackfilter_faketime_check(opt_faketime); } @@ -1154,7 +1154,7 @@ trackfilter_faketime() /* returns number of track points left after QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { Waypoint* wpt = (Waypoint*)elem; - if (opt_faketime != 0 && (!wpt->creation_time.isValid() || faketime.force)) { + if (opt_faketime != nullptr && (!wpt->creation_time.isValid() || faketime.force)) { wpt->creation_time = QDateTime::fromTime_t(faketime.start); faketime.start += faketime.step; } @@ -1194,7 +1194,7 @@ trackfilter_segment_head(const route_head* rte) queue* elem, *tmp; double avg_dist = 0; int index = 0; - Waypoint* prev_wpt = NULL; + Waypoint* prev_wpt = nullptr; // Consider tossing trackpoints closer than this in radians. // (Empirically determined; It's a few dozen feet.) const double ktoo_close = 0.000005; @@ -1256,7 +1256,7 @@ trackfilter_init(const char*) (trackfilter_opt_count() == 0) /* do pack by default */ ); /* in case of a formated title we also need valid timestamps */ - if ((opt_title != NULL) && (strchr(opt_title, '%') != NULL)) { + if ((opt_title != nullptr) && (strchr(opt_title, '%') != nullptr)) { need_time = 1; } @@ -1265,7 +1265,7 @@ trackfilter_init(const char*) // Perform segmenting first. if (opt_segment) { - track_disp_all(trackfilter_segment_head, NULL, NULL); + track_disp_all(trackfilter_segment_head, nullptr, nullptr); } if (count > 0) { @@ -1273,7 +1273,7 @@ trackfilter_init(const char*) /* check all tracks for time and order (except merging) */ - track_disp_all(trackfilter_fill_track_list_cb, NULL, NULL); + track_disp_all(trackfilter_fill_track_list_cb, nullptr, nullptr); if (need_time) { qsort(track_list, track_ct, sizeof(*track_list), trackfilter_init_qsort_cb); } @@ -1306,13 +1306,13 @@ trackfilter_process() opts = -1; /* flag for do "pack" by default */ } - if (opt_name != NULL) { + if (opt_name != nullptr) { if (--opts == 0) { return; } } - if (opt_move != NULL) { /* Correct timestamps before any other op */ + if (opt_move != nullptr) { /* Correct timestamps before any other op */ trackfilter_move(); if (--opts == 0) { return; @@ -1335,7 +1335,7 @@ trackfilter_process() } } - if ((opt_faketime != NULL)) { + if ((opt_faketime != nullptr)) { opts--; trackfilter_faketime(); @@ -1345,18 +1345,18 @@ trackfilter_process() } trackfilter_deinit(); /* reinitialize */ - trackfilter_init(NULL); + trackfilter_init(nullptr); if (track_ct == 0) { return; /* no more track(s), no more fun */ } } - if ((opt_stop != NULL) || (opt_start != NULL)) { - if (opt_start != NULL) { + if ((opt_stop != nullptr) || (opt_start != nullptr)) { + if (opt_start != nullptr) { opts--; } - if (opt_stop != NULL) { + if (opt_stop != nullptr) { opts--; } @@ -1367,7 +1367,7 @@ trackfilter_process() } trackfilter_deinit(); /* reinitialize */ - trackfilter_init(NULL); + trackfilter_init(nullptr); if (track_ct == 0) { return; /* no more track(s), no more fun */ @@ -1375,24 +1375,24 @@ trackfilter_process() } - if (opt_seg2trk != NULL) { + if (opt_seg2trk != nullptr) { trackfilter_seg2trk(); if (--opts == 0) { return; } trackfilter_deinit(); /* reinitialize */ - trackfilter_init(NULL); + trackfilter_init(nullptr); } - if (opt_trk2seg != NULL) { + if (opt_trk2seg != nullptr) { trackfilter_trk2seg(); if (--opts == 0) { return; } } - if (opt_title != NULL) { + if (opt_title != nullptr) { if (--opts == 0) { trackfilter_title(); return; @@ -1401,22 +1401,22 @@ trackfilter_process() something_done = 0; - if ((opt_pack != NULL) || (opts == -1)) { /* call our default option */ + if ((opt_pack != nullptr) || (opts == -1)) { /* call our default option */ trackfilter_pack(); something_done = 1; - } else if (opt_merge != NULL) { + } else if (opt_merge != nullptr) { trackfilter_merge(); something_done = 1; } if ((something_done == 1) && (--opts <= 0)) { - if (opt_title != NULL) { + if (opt_title != nullptr) { trackfilter_title(); } return; } - if ((opt_split != NULL) || (opt_sdistance != NULL)) { + if ((opt_split != nullptr) || (opt_sdistance != nullptr)) { if (track_ct > 1) { fatal(MYNAME "-split: Cannot split more than one track, please pack (or merge) before!\n"); } @@ -1425,8 +1425,8 @@ trackfilter_process() } // Performed last as previous options may have created "small" tracks. - if ((opt_minpoints != NULL) && atoi(opt_minpoints) > 0) { - track_disp_all(trackfilter_minpoint_list_cb, NULL, NULL); + if ((opt_minpoints != nullptr) && atoi(opt_minpoints) > 0) { + track_disp_all(trackfilter_minpoint_list_cb, nullptr, nullptr); } } @@ -1436,7 +1436,7 @@ filter_vecs_t trackfilter_vecs = { trackfilter_init, trackfilter_process, trackfilter_deinit, - NULL, + nullptr, trackfilter_args }; diff --git a/transform.cc b/transform.cc index fbbf509a9..21c0a0d87 100644 --- a/transform.cc +++ b/transform.cc @@ -44,20 +44,20 @@ static char RPT[] = "RPT"; static arglist_t transform_args[] = { { - "wpt", &opt_waypts, "Transform track(s) or route(s) into waypoint(s) [R/T]", NULL, + "wpt", &opt_waypts, "Transform track(s) or route(s) into waypoint(s) [R/T]", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { - "rte", &opt_routes, "Transform waypoint(s) or track(s) into route(s) [W/T]", NULL, + "rte", &opt_routes, "Transform waypoint(s) or track(s) into route(s) [W/T]", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { - "trk", &opt_tracks, "Transform waypoint(s) or route(s) into tracks(s) [W/R]", NULL, + "trk", &opt_tracks, "Transform waypoint(s) or route(s) into tracks(s) [W/R]", nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { - "rptdigits", &rpt_name_digits, "Number of digits in generated names", NULL, - ARGTYPE_INT, "2", NULL, nullptr + "rptdigits", &rpt_name_digits, "Number of digits in generated names", nullptr, + ARGTYPE_INT, "2", nullptr, nullptr }, { "rptname", &opt_rpt_name, "Use source name for route point names", "N", @@ -155,13 +155,13 @@ transform_any_disp_wpt_cb(const Waypoint* wpt) static void transform_routes() { - route_disp_all(transform_rte_disp_hdr_cb, NULL, transform_any_disp_wpt_cb); + route_disp_all(transform_rte_disp_hdr_cb, nullptr, transform_any_disp_wpt_cb); } static void transform_tracks() { - track_disp_all(transform_trk_disp_hdr_cb, NULL, transform_any_disp_wpt_cb); + track_disp_all(transform_trk_disp_hdr_cb, nullptr, transform_any_disp_wpt_cb); } /******************************************************************************* @@ -190,7 +190,7 @@ transform_process() name_digits = atoi(rpt_name_digits); } - if (opt_waypts != NULL) { + if (opt_waypts != nullptr) { current_target = 'W'; switch (toupper(*opt_waypts)) { case 'R': @@ -209,7 +209,7 @@ transform_process() fatal(MYNAME ": Invalid option value (%s)!\n", opt_waypts); } } - if (opt_routes != NULL) { + if (opt_routes != nullptr) { current_target = 'R'; switch (toupper(*opt_routes)) { case 'W': @@ -228,7 +228,7 @@ transform_process() fatal(MYNAME ": Invalid option value (%s)!\n", opt_routes); } } - if (opt_tracks != NULL) { + if (opt_tracks != nullptr) { current_target = 'T'; switch (toupper(*opt_tracks)) { case 'W': @@ -255,7 +255,7 @@ filter_vecs_t transform_vecs = { transform_init, transform_process, transform_deinit, - NULL, + nullptr, transform_args }; diff --git a/unicsv.cc b/unicsv.cc index c08c9a37a..09767b413 100644 --- a/unicsv.cc +++ b/unicsv.cc @@ -237,7 +237,7 @@ static field_t fields_def[] = { { "placer_id", fld_gc_placer_id, STR_ANY }, { "placer", fld_gc_placer, STR_ANY }, { "hint", fld_gc_hint, STR_ANY }, - { NULL, fld_terminator, 0 } + { nullptr, fld_terminator, 0 } }; static QVector unicsv_fields_tab; @@ -268,19 +268,19 @@ static arglist_t unicsv_args[] = { }, { "grid", &opt_grid, "Write position using this grid.", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "utc", &opt_utc, "Write timestamps with offset x to UTC time", - NULL, ARGTYPE_INT, "-23", "+23", nullptr + nullptr, ARGTYPE_INT, "-23", "+23", nullptr }, { "format", &opt_format, "Write name(s) of format(s) from input session(s)", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "filename", &opt_filename, "Write filename(s) from input session(s)", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "prec", &opt_prec, "Precision of numerical coordinates (no grid set)", @@ -288,7 +288,7 @@ static arglist_t unicsv_args[] = { }, { "fields", &opt_fields, "Name and order of input fields, separated by '+'", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -474,7 +474,7 @@ unicsv_compare_fields(const char* s, const field_t* f) if (f->options & STR_EQUAL) { result = (strcmp(test, name) == 0); } else if (f->options & STR_ANY) { - result = (strstr(test, name) != NULL); + result = (strstr(test, name) != nullptr); } else { if (f->options & STR_LEFT) { result = (strncmp(test, name, strlen(name)) == 0); @@ -485,13 +485,13 @@ unicsv_compare_fields(const char* s, const field_t* f) } } - if ((! result) && (strchr(test, ' ') != NULL)) { + if ((! result) && (strchr(test, ' ') != nullptr)) { /* replace ' ' with '_' and try again */ char* tmp = gstrsub(test, " ", "_"); result = unicsv_compare_fields(tmp, f); xfree(tmp); } - if ((! result) && (strchr(test, '-') != NULL)) { + if ((! result) && (strchr(test, '-') != nullptr)) { /* replace '-' with '_' and try again */ char* tmp = gstrsub(test, "-", "_"); result = unicsv_compare_fields(tmp, f); @@ -516,8 +516,8 @@ static void unicsv_fondle_header(QString s) { // TODO: clean up this back and forth between QString and char*. - char* buf = NULL; - char* cbuf_start = NULL; + char* buf = nullptr; + char* cbuf_start = nullptr; const cet_cs_vec_t* ascii = &cet_cs_vec_ansi_x3_4_1968; /* us-ascii */ /* Convert the entire header to lower case for convenience. @@ -545,7 +545,7 @@ unicsv_fondle_header(QString s) field_t* f = &fields_def[0]; - cbuf = NULL; + cbuf = nullptr; unicsv_fields_tab.append(fld_terminator); while (f->name) { @@ -601,7 +601,7 @@ unicsv_rd_init(const QString& fname) unicsv_data_type = global_opts.objective; unicsv_detect = (!(global_opts.masked_objective & (WPTDATAMASK | TRKDATAMASK | RTEDATAMASK | POSNDATAMASK))); - unicsv_track = unicsv_route = NULL; + unicsv_track = unicsv_route = nullptr; unicsv_datum_idx = gt_lookup_datum_index(opt_datum, MYNAME); fin = gbfopen(fname, "rb", MYNAME); @@ -611,7 +611,7 @@ unicsv_rd_init(const QString& fname) } else if ((c = gbfgetstr(fin))) { unicsv_fondle_header(c); } else { - unicsv_fieldsep = NULL; + unicsv_fieldsep = nullptr; } if (fin->unicode) { cet_convert_init(CET_CHARSET_UTF8, 1); @@ -628,7 +628,7 @@ unicsv_rd_deinit() static void unicsv_parse_one_line(char* ibuf) { - Waypoint* wpt = NULL; + Waypoint* wpt = nullptr; int column; int utm_zone = -9999; double utm_easting = 0; @@ -651,7 +651,7 @@ unicsv_parse_one_line(char* ibuf) int src_datum = unicsv_datum_idx; int ns = 1; int ew = 1; - geocache_data* gc_data = NULL; + geocache_data* gc_data = nullptr; wpt = new Waypoint; wpt->latitude = unicsv_unknown; wpt->longitude = unicsv_unknown; @@ -664,7 +664,7 @@ unicsv_parse_one_line(char* ibuf) break; /* ignore extra fields on line */ } - ibuf = NULL; + ibuf = nullptr; checked++; s = s.trimmed(); @@ -689,12 +689,12 @@ unicsv_parse_one_line(char* ibuf) switch (unicsv_fields_tab[column]) { case fld_latitude: - human_to_dec(CSTR(s), &wpt->latitude, NULL, 1); + human_to_dec(CSTR(s), &wpt->latitude, nullptr, 1); wpt->latitude = wpt->latitude * ns; break; case fld_longitude: - human_to_dec(CSTR(s), NULL, &wpt->longitude, 2); + human_to_dec(CSTR(s), nullptr, &wpt->longitude, 2); wpt->longitude = wpt->longitude * ew; break; @@ -833,7 +833,7 @@ unicsv_parse_one_line(char* ibuf) case fld_utc_date: if ((is_localtime < 2) && (date < 0)) { - date = unicsv_parse_date(CSTR(s), NULL); + date = unicsv_parse_date(CSTR(s), nullptr); is_localtime = 0; } break; @@ -926,7 +926,7 @@ unicsv_parse_one_line(char* ibuf) case fld_date: if ((is_localtime < 2) && (date < 0)) { - date = unicsv_parse_date(CSTR(s), NULL); + date = unicsv_parse_date(CSTR(s), nullptr); is_localtime = 1; } break; @@ -1217,7 +1217,7 @@ unicsv_rd() { char* buff; - if (unicsv_fieldsep == NULL) { + if (unicsv_fieldsep == nullptr) { return; } @@ -1238,7 +1238,7 @@ unicsv_fatal_outside(const Waypoint* wpt) gbfprintf(fout, "#####\n"); fatal(MYNAME ": %s (%s) is outside of convertable area of grid \"%s\"!\n", wpt->shortname.isEmpty() ? "Waypoint" : qPrintable(wpt->shortname), - pretty_deg_format(wpt->latitude, wpt->longitude, 'd', NULL, 0), + pretty_deg_format(wpt->latitude, wpt->longitude, 'd', nullptr, 0), gt_get_mps_grid_longname(unicsv_grid_idx, MYNAME)); } @@ -1433,9 +1433,9 @@ static void unicsv_waypt_disp_cb(const Waypoint* wpt) { double lat, lon, alt; - char* cout = NULL; + char* cout = nullptr; garmin_fs_t* gmsd; - const geocache_data* gc_data = NULL; + const geocache_data* gc_data = nullptr; unicsv_waypt_ct++; QString shortname = wpt->shortname; @@ -1599,7 +1599,7 @@ unicsv_waypt_disp_cb(const Waypoint* wpt) fix = "pps"; break; default: - fix = NULL; + fix = nullptr; } if (fix) { unicsv_print_str(fix); @@ -1735,7 +1735,7 @@ unicsv_waypt_disp_cb(const Waypoint* wpt) } if (wpt->EmptyGCData()) { - gc_data = NULL; + gc_data = nullptr; } else { gc_data = wpt->gc_data; } @@ -1844,7 +1844,7 @@ unicsv_wr_init(const QString& filename) unicsv_fieldsep = UNICSV_FIELD_SEP; unicsv_waypt_ct = 0; - if (opt_grid != NULL) { + if (opt_grid != nullptr) { int i; if (sscanf(opt_grid, "%d", &i)) { @@ -1904,11 +1904,11 @@ unicsv_wr() break; case trkdata: unicsv_check_modes (doing_rtes); - track_disp_all(NULL, NULL, unicsv_waypt_enum_cb); + track_disp_all(nullptr, nullptr, unicsv_waypt_enum_cb); break; case rtedata: unicsv_check_modes (doing_trks); - route_disp_all(NULL, NULL, unicsv_waypt_enum_cb); + route_disp_all(nullptr, nullptr, unicsv_waypt_enum_cb); break; case posndata: Fatal() << MYNAME << ": Realtime positioning not supported."; @@ -2084,10 +2084,10 @@ unicsv_wr() waypt_disp_all(unicsv_waypt_disp_cb); break; case trkdata: - track_disp_all(NULL, NULL, unicsv_waypt_disp_cb); + track_disp_all(nullptr, nullptr, unicsv_waypt_disp_cb); break; case rtedata: - route_disp_all(NULL, NULL, unicsv_waypt_disp_cb); + route_disp_all(nullptr, nullptr, unicsv_waypt_disp_cb); break; default: break; @@ -2105,7 +2105,7 @@ ff_vecs_t unicsv_vecs = { unicsv_wr_deinit, unicsv_rd, unicsv_wr, - NULL, + nullptr, unicsv_args, CET_CHARSET_ASCII, 0 /* can be changed with -c ... */ , NULL_POS_OPS, diff --git a/util.cc b/util.cc index e28b3fe68..3d6d93e0d 100644 --- a/util.cc +++ b/util.cc @@ -238,9 +238,9 @@ FILE* xfopen(const char* fname, const char* type, const char* errtxt) { FILE* f; - int am_writing = strchr(type, 'w') != NULL; + int am_writing = strchr(type, 'w') != nullptr; - if (fname == NULL) { + if (fname == nullptr) { fatal("%s must have a filename specified for %s.\n", errtxt, am_writing ? "write" : "read"); } @@ -249,7 +249,7 @@ xfopen(const char* fname, const char* type, const char* errtxt) return am_writing ? stdout : stdin; } f = ufopen(QString::fromUtf8(fname), type); - if (NULL == f) { + if (nullptr == f) { fatal("%s cannot open '%s' for %s. Error was '%s'.\n", errtxt, fname, am_writing ? "write" : "read", @@ -336,7 +336,7 @@ xvasprintf(char** strp, const char* fmt, va_list ap) #else # define FIRSTSIZE 1 #endif - char* buf = NULL; + char* buf = nullptr; int bufsize; char* newbuf; size_t nextsize = 0; @@ -346,17 +346,17 @@ xvasprintf(char** strp, const char* fmt, va_list ap) bufsize = 0; for (;;) { if (bufsize == 0) { - if ((buf = (char*) xmalloc(FIRSTSIZE)) == NULL) { - *strp = NULL; + if ((buf = (char*) xmalloc(FIRSTSIZE)) == nullptr) { + *strp = nullptr; return -1; } bufsize = FIRSTSIZE; - } else if ((newbuf = (char*) xrealloc(buf, nextsize)) != NULL) { + } else if ((newbuf = (char*) xrealloc(buf, nextsize)) != nullptr) { buf = newbuf; bufsize = nextsize; } else { xfree(buf); - *strp = NULL; + *strp = nullptr; return -1; } @@ -846,7 +846,7 @@ month_lookup(const char* m) { static const char* months[] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", - "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", NULL + "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", nullptr }; const char** mp; @@ -891,7 +891,7 @@ const char* get_cache_icon(const Waypoint* waypointp) { if (!global_opts.smart_icons) { - return NULL; + return nullptr; } /* @@ -925,7 +925,7 @@ get_cache_icon(const Waypoint* waypointp) return "Geocache"; } - return NULL; + return nullptr; } double @@ -1099,7 +1099,7 @@ strsub(const char* s, const char* search, const char* replace) p = strstr(s, search); if (!slen || !p) { - return NULL; + return nullptr; } d = (char*) xmalloc(len + rlen + 1); @@ -1383,7 +1383,7 @@ pretty_deg_format(double lat, double lon, char fmt, const char* sep, int html) lonmin = 60.0 * (fabs(lon) - lonint); latsec = 60.0 * (latmin - floor(latmin)); lonsec = 60.0 * (lonmin - floor(lonmin)); - if (sep == NULL) { + if (sep == nullptr) { sep = " "; /* default " " */ } if (fmt == 'd') { /* ddd */ @@ -1420,7 +1420,7 @@ strip_nastyhtml(const QString& in) sp = returnstr = xstrdup(in); lcp = lcstr = strlower(xstrdup(in)); - while (lcp = strstr(lcstr, ""), NULL != lcp) { + while (lcp = strstr(lcstr, ""), nullptr != lcp) { sp = returnstr + (lcp - lcstr) ; /* becomes */ sp++; *sp++ = '!'; @@ -1429,7 +1429,7 @@ strip_nastyhtml(const QString& in) *sp++ = ' '; *lcp = '*'; /* so we wont find it again */ } - while (lcp = strstr(lcstr, " */ + while (lcp = strstr(lcstr, " */ sp = returnstr + (lcp - lcstr) ; sp++; *sp++ = '!'; @@ -1442,7 +1442,7 @@ strip_nastyhtml(const QString& in) *--sp = '-'; *lcp = '*'; /* so we wont find it again */ } - while (lcp = strstr(lcstr, ""), NULL != lcp) { + while (lcp = strstr(lcstr, ""), nullptr != lcp) { sp = returnstr + (lcp - lcstr) ; /* becomes */ *sp++ = ' '; *sp++ = ' '; @@ -1484,7 +1484,7 @@ strip_nastyhtml(const QString& in) *sp++ = '-'; *lcp = '*'; /* so we wont find it again */ } - while (lcp = strstr(lcstr, "text) { cp = str; - while ((cp = strstr(cp, ep->text)) != NULL) { + while ((cp = strstr(cp, ep->text)) != nullptr) { elen += strlen(ep->entity) - strlen(ep->text); ecount++; cp += strlen(ep->text); @@ -1696,7 +1696,7 @@ entitize(const char* str, bool is_html) if (is_html && ep->not_html) { continue; } - while ((p = strstr(p, ep->text)) != NULL) { + while ((p = strstr(p, ep->text)) != nullptr) { elen = strlen(ep->entity); xstr = xstrdup(p + strlen(ep->text)); @@ -1719,7 +1719,7 @@ entitize(const char* str, bool is_html) if (p[bytes]) { xstr = xstrdup(p + bytes); } else { - xstr = NULL; + xstr = nullptr; } sprintf(p, "&#x%x;", value); p = p+strlen(p); @@ -1766,7 +1766,7 @@ xml_tag* xml_next(xml_tag* root, xml_tag* cur) } else { cur = cur->parent; if (cur == root) { - cur = NULL; + cur = nullptr; } if (cur) { cur = cur->sibling; @@ -1791,7 +1791,7 @@ xml_tag* xml_findfirst(xml_tag* root, const char* tagname) char* xml_attribute(xml_tag* tag, const char* attrname) { - char* result = NULL; + char* result = nullptr; if (tag->attributes) { char** attr = tag->attributes; while (attr && *attr) { @@ -1839,7 +1839,7 @@ void* gb_int2ptr(const int i) union { void* p; int i; - } x = { NULL }; + } x = { nullptr }; x.i = i; return x.p; diff --git a/v900.cc b/v900.cc index fa3b1380c..4ec816ba0 100644 --- a/v900.cc +++ b/v900.cc @@ -141,7 +141,7 @@ struct one_line_basic_mode { }; -static FILE* fin = NULL; +static FILE* fin = nullptr; /* copied from dg-100.cpp */ static void @@ -226,7 +226,7 @@ v900_read() if (!fgets(line.text, sizeof(line), fin)) { fatal("v900: error reading header (first) line from input file\n"); } - is_advanced_mode = (NULL != strstr(line.text,"PDOP")); /* PDOP field appears only in advanced mode */ + is_advanced_mode = (nullptr != strstr(line.text,"PDOP")); /* PDOP field appears only in advanced mode */ v900_log("header line: %s",line.text); v900_log("is_advance_mode=%d\n",is_advanced_mode); @@ -378,14 +378,14 @@ ff_vecs_t v900_vecs = { ff_type_file, {ff_cap_read, ff_cap_read, ff_cap_none}, /* Read only format. May only read trackpoints and waypoints. */ v900_rd_init, - NULL, /* wr_init */ + nullptr, /* wr_init */ v900_rd_deinit, - NULL, /* wr_deinit */ + nullptr, /* wr_deinit */ v900_read, - NULL, /* write */ - NULL, - NULL, /* args */ + nullptr, /* write */ + nullptr, + nullptr, /* args */ CET_CHARSET_UTF8, 1, /* Could be US-ASCII, since we only read "0-9,A-Z\n\r" */ - {NULL,NULL,NULL,NULL,NULL,NULL}, + {nullptr,nullptr,nullptr,nullptr,nullptr,nullptr}, nullptr }; diff --git a/validate.cc b/validate.cc index 7585e9646..61a3ec188 100644 --- a/validate.cc +++ b/validate.cc @@ -135,10 +135,10 @@ validate_process() } filter_vecs_t validate_vecs = { - NULL, + nullptr, validate_process, - NULL, - NULL, + nullptr, + nullptr, validate_args }; diff --git a/vcf.cc b/vcf.cc index 776908daf..6541ea0bc 100644 --- a/vcf.cc +++ b/vcf.cc @@ -27,7 +27,7 @@ static gbfile* file_out; static short_handle mkshort_handle; -static char* vcf_encrypt = NULL; +static char* vcf_encrypt = nullptr; #define MYNAME "VCF" @@ -35,7 +35,7 @@ static arglist_t vcf_args[] = { { "encrypt", &vcf_encrypt, - "Encrypt hints using ROT13", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + "Encrypt hints using ROT13", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -142,13 +142,13 @@ data_write() ff_vecs_t vcf_vecs = { ff_type_file, { ff_cap_write, ff_cap_none, ff_cap_none}, - NULL, + nullptr, wr_init, - NULL, + nullptr, wr_deinit, - NULL, + nullptr, data_write, - NULL, + nullptr, vcf_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, diff --git a/vecs.cc b/vecs.cc index 2edbe55e0..f92b43aca 100644 --- a/vecs.cc +++ b/vecs.cc @@ -188,8 +188,8 @@ vecs_t vec_list[] = { &xcsv_vecs, "xcsv", "? Character Separated Values", - NULL, - NULL, + nullptr, + nullptr, }, #endif { @@ -197,183 +197,183 @@ vecs_t vec_list[] = { "geo", "Geocaching.com .loc", "loc", - NULL, + nullptr, }, { &gpx_vecs, "gpx", "GPX XML", "gpx", - NULL, + nullptr, }, { &mag_svecs, "magellan", "Magellan serial protocol", - NULL, - NULL, + nullptr, + nullptr, }, { &mag_fvecs, "magellan", "Magellan SD files (as for Meridian)", - NULL, - NULL, + nullptr, + nullptr, }, { &magX_fvecs, "magellanx", "Magellan SD files (as for eXplorist)", "upt", - NULL, + nullptr, }, { &garmin_vecs, "garmin", "Garmin serial/USB protocol", - NULL, - NULL, + nullptr, + nullptr, }, { &gdb_vecs, "gdb", "Garmin MapSource - gdb", "gdb", - NULL, + nullptr, }, { &mapsend_vecs, "mapsend", "Magellan Mapsend", - NULL, - NULL, + nullptr, + nullptr, }, { &mps_vecs, "mapsource", "Garmin MapSource - mps", "mps", - NULL, + nullptr, }, { &nmea_vecs, "nmea", "NMEA 0183 sentences", - NULL, - NULL, + nullptr, + nullptr, }, { &ozi_vecs, "ozi", "OziExplorer", - NULL, - NULL, + nullptr, + nullptr, }, { &pcx_vecs, "pcx", "Garmin PCX5", "pcx", - NULL, + nullptr, }, { &kml_vecs, "kml", "Google Earth (Keyhole) Markup Language", "kml", - NULL, + nullptr, }, #if MAXIMAL_ENABLED { &gpsutil_vecs, "gpsutil", "gpsutil", - NULL, - NULL, + nullptr, + nullptr, }, { &lowranceusr_vecs, "lowranceusr", "Lowrance USR", "usr", - NULL, + nullptr, }, { &lowranceusr4_vecs, "lowranceusr4", "Lowrance USR version 4", "usr", - NULL, + nullptr, }, { &holux_vecs, "holux", "Holux (gm-100) .wpo Format", "wpo", - NULL, + nullptr, }, { &tpg_vecs, "tpg", "National Geographic Topo .tpg (waypoints)", "tpg", - NULL, + nullptr, }, { &tpo2_vecs, "tpo2", "National Geographic Topo 2.x .tpo", "tpo", - NULL, + nullptr, }, { &tpo3_vecs, "tpo3", "National Geographic Topo 3.x/4.x .tpo", "tpo", - NULL, + nullptr, }, { &tmpro_vecs, "tmpro", "TopoMapPro Places File", "tmpro", - NULL, + nullptr, }, { &tiger_vecs, "tiger", "U.S. Census Bureau Tiger Mapping Service", - NULL, - NULL, + nullptr, + nullptr, }, { &easygps_vecs, "easygps", "EasyGPS binary format", "loc", - NULL, + nullptr, }, { &saroute_vecs, "saroute", "DeLorme Street Atlas Route", "anr", - NULL, + nullptr, }, { &navicache_vecs, "navicache", "Navicache.com XML", - NULL, - NULL, + nullptr, + nullptr, }, { /* MRCB */ &psit_vecs, "psitrex", "KuDaTa PsiTrex text", - NULL, - NULL, + nullptr, + nullptr, }, #if SHAPELIB_ENABLED { @@ -381,7 +381,7 @@ vecs_t vec_list[] = { "shape", "ESRI shapefile", "shp", - NULL, + nullptr, }, #endif { @@ -389,191 +389,191 @@ vecs_t vec_list[] = { "gpl", "DeLorme GPL", "gpl", - NULL, + nullptr, }, { &text_vecs, "text", "Textual Output", "txt", - NULL, + nullptr, }, { &html_vecs, "html", "HTML Output", "html", - NULL, + nullptr, }, { &netstumbler_vecs, "netstumbler", "NetStumbler Summary File (text)", - NULL, - NULL, + nullptr, + nullptr, }, { &igc_vecs, "igc", "FAI/IGC Flight Recorder Data Format", - NULL, - NULL, + nullptr, + nullptr, }, { &brauniger_iq_vecs, "baroiq", "Brauniger IQ Series Barograph Download", - NULL, - NULL, + nullptr, + nullptr, }, { &mtk_vecs, "mtk", "MTK Logger (iBlue 747,Qstarz BT-1000,...) download", - NULL, - NULL, + nullptr, + nullptr, }, { &mtk_fvecs, "mtk-bin", "MTK Logger (iBlue 747,...) Binary File Format", "bin", - NULL, + nullptr, }, { &mtk_m241_vecs, "m241", "Holux M-241 (MTK based) download", - NULL, - NULL, + nullptr, + nullptr, }, { &mtk_m241_fvecs, "m241-bin", "Holux M-241 (MTK based) Binary File Format", "bin", - NULL, + nullptr, }, { &mtk_locus_vecs, "mtk_locus", "MediaTek Locus", - NULL, - NULL, + nullptr, + nullptr, }, #endif // MAXIMAL_ENABLED { &wbt_svecs, "wbt", "Wintec WBT-100/200 GPS Download", - NULL, - NULL, + nullptr, + nullptr, }, #if MAXIMAL_ENABLED { &vpl_vecs, "vpl", "Honda/Acura Navigation System VP Log File Format", - NULL, - NULL, + nullptr, + nullptr, }, { &wbt_fvecs, "wbt-bin", "Wintec WBT-100/200 Binary File Format", "bin", - NULL, + nullptr, }, { &wbt_fvecs, "wbt-tk1", "Wintec WBT-201/G-Rays 2 Binary File Format", "tk1", - NULL, + nullptr, }, { &hiketech_vecs, "hiketech", "HikeTech", "gps", - NULL, + nullptr, }, { &glogbook_vecs, "glogbook", "Garmin Logbook XML", "xml", - NULL, + nullptr, }, { &vcf_vecs, "vcard", "Vcard Output (for iPod)", "vcf", - NULL, + nullptr, }, { &google_dir_vecs, "googledir", "Google Directions XML", "xml", - NULL, + nullptr, }, { &maggeo_vecs, "maggeo", "Magellan Explorist Geocaching", "gs", - NULL, + nullptr, }, { &an1_vecs, "an1", "DeLorme .an1 (drawing) file", "an1", - NULL, + nullptr, }, { &tomtom_vecs, "tomtom", "TomTom POI file (.ov2)", "ov2", - NULL, + nullptr, }, { &tef_xml_vecs, "tef", "Map&Guide 'TourExchangeFormat' XML", "xml", - NULL, + nullptr, }, { &vitosmt_vecs, "vitosmt", "Vito Navigator II tracks", "smt", - NULL, + nullptr, }, { &wfff_xml_vecs, "wfff", "WiFiFoFum 2.0 for PocketPC XML", "xml", - NULL, + nullptr, }, { &bcr_vecs, "bcr", "Motorrad Routenplaner (Map&Guide) .bcr files", "bcr", - NULL, + nullptr, }, { &ignr_vecs, "ignrando", "IGN Rando track files", "rdn", - NULL, + nullptr, }, #if CSVFMTS_ENABLED { @@ -581,7 +581,7 @@ vecs_t vec_list[] = { "stmsdf", "Suunto Trek Manager (STM) .sdf files", "sdf", - NULL, + nullptr, }, #endif #if CSVFMTS_ENABLED @@ -590,7 +590,7 @@ vecs_t vec_list[] = { "stmwpp", "Suunto Trek Manager (STM) WaypointPlus files", "txt", - NULL, + nullptr, }, #endif // CSVFMTS_ENABLED { @@ -598,51 +598,51 @@ vecs_t vec_list[] = { "cst", "CarteSurTable data file", "cst", - NULL, + nullptr, }, { &nmn4_vecs, "nmn4", "Navigon Mobile Navigator .rte files", "rte", - NULL, + nullptr, }, #if CSVFMTS_ENABLED { &compegps_vecs, "compegps", "CompeGPS data files (.wpt/.trk/.rte)", - NULL, - NULL, + nullptr, + nullptr, }, #endif //CSVFMTS_ENABLED { &yahoo_vecs, "yahoo", "Yahoo Geocode API data", - NULL, - NULL, + nullptr, + nullptr, }, { &unicsv_vecs, "unicsv", "Universal csv with field structure in first line", - NULL, - NULL, + nullptr, + nullptr, }, { >m_vecs, "gtm", "GPS TrackMaker", "gtm", - NULL, + nullptr, }, { &gpssim_vecs, "gpssim", "Franson GPSGate Simulation", "gpssim", - NULL, + nullptr, }, #if CSVFMTS_ENABLED { @@ -650,7 +650,7 @@ vecs_t vec_list[] = { "garmin_txt", "Garmin MapSource - txt (tab delimited)", "txt", - NULL, + nullptr, }, #endif // CSVFMTS_ENABLED { @@ -658,49 +658,49 @@ vecs_t vec_list[] = { "gtrnctr", "Garmin Training Center (.tcx/.crs/.hst/.xml)", "tcx/crs/hst/xml", - NULL, + nullptr, }, { &dmtlog_vecs, "dmtlog", "TrackLogs digital mapping (.trl)", "trl", - NULL, + nullptr, }, { &raymarine_vecs, "raymarine", "Raymarine Waypoint File (.rwf)", "rwf", - NULL, + nullptr, }, { &alanwpr_vecs, "alanwpr", "Alan Map500 waypoints and routes (.wpr)", "wpr", - NULL, + nullptr, }, { &alantrl_vecs, "alantrl", "Alan Map500 tracklogs (.trl)", "trl", - NULL, + nullptr, }, { &vitovtt_vecs, "vitovtt", "Vito SmartMap tracks (.vtt)", "vtt", - NULL, + nullptr, }, { &ggv_log_vecs, "ggv_log", "Geogrid-Viewer tracklogs (.log)", "log", - NULL, + nullptr, }, #if CSVFMTS_ENABLED { @@ -708,7 +708,7 @@ vecs_t vec_list[] = { "g7towin", "G7ToWin data files (.g7t)", "g7t", - NULL, + nullptr, }, #endif { @@ -716,154 +716,154 @@ vecs_t vec_list[] = { "garmin_gpi", "Garmin Points of Interest (.gpi)", "gpi", - NULL, + nullptr, }, { &lmx_vecs, "lmx", "Nokia Landmark Exchange", - NULL, - NULL, + nullptr, + nullptr, }, { &random_vecs, "random", "Internal GPS data generator", - NULL, - NULL, + nullptr, + nullptr, }, { &xol_vecs, "xol", "Swiss Map 25/50/100 (.xol)", "xol", - NULL, + nullptr, }, { &dg100_vecs, "dg-100", "GlobalSat DG-100/BT-335 Download", - NULL, - NULL, + nullptr, + nullptr, }, { &dg200_vecs, "dg-200", "GlobalSat DG-200 Download", - NULL, - NULL, + nullptr, + nullptr, }, { &navilink_vecs, "navilink", "NaviGPS GT-11/BGT-11 Download", - NULL, - NULL, + nullptr, + nullptr, }, { &ik3d_vecs, "ik3d", "MagicMaps IK3D project file (.ikt)", "ikt", - NULL, + nullptr, }, { &osm_vecs, "osm", "OpenStreetMap data files", "osm", - NULL, + nullptr, }, { &destinator_poi_vecs, "destinator_poi", "Destinator Points of Interest (.dat)", "dat", - NULL, + nullptr, }, { &destinator_itn_vecs, "destinator_itn", "Destinator Itineraries (.dat)", "dat", - NULL, + nullptr, }, { &destinator_trl_vecs, "destinator_trl", "Destinator TrackLogs (.dat)", "dat", - NULL, + nullptr, }, { &exif_vecs, "exif", "Embedded Exif-GPS data (.jpg)", "jpg", - NULL, + nullptr, }, { &vidaone_vecs, "vidaone", "VidaOne GPS for Pocket PC (.gpb)", "gpb", - NULL, + nullptr, }, { &igo8_vecs, "igo8", "IGO8 .trk", "trk", - NULL, + nullptr, }, { &gopal_vecs, "gopal", "GoPal GPS track log (.trk)", "trk", - NULL, + nullptr, }, { &humminbird_vecs, "humminbird", "Humminbird waypoints and routes (.hwr)", "hwr", - NULL, + nullptr, }, { &humminbird_ht_vecs, "humminbird_ht", "Humminbird tracks (.ht)", "ht", - NULL, + nullptr, }, { &mapasia_tr7_vecs, "mapasia_tr7", "MapAsia track file (.tr7)", "tr7", - NULL, + nullptr, }, { &gnav_trl_vecs, "gnav_trl", "Google Navigator Tracklines (.trl)", "trl", - NULL, + nullptr, }, { &navitel_trk_vecs, "navitel_trk", "Navitel binary track (.bin)", "bin", - NULL, + nullptr, }, { &ggv_ovl_vecs, "ggv_ovl", "Geogrid-Viewer ascii overlay file (.ovl)", "ovl", - NULL, + nullptr, }, #if CSVFMTS_ENABLED { @@ -871,15 +871,15 @@ vecs_t vec_list[] = { "jtr", "Jelbert GeoTagger data file", "jtr", - NULL, + nullptr, }, #endif { &itracku_vecs, "itracku", "XAiOX iTrackU Logger", - NULL, - NULL, + nullptr, + nullptr, }, { @@ -887,218 +887,218 @@ vecs_t vec_list[] = { "itracku-bin", "XAiOX iTrackU Logger Binary File Format", "bin", - NULL, + nullptr, }, { &sbp_vecs, "sbp", "NaviGPS GT-31/BGT-31 datalogger (.sbp)", "sbp", - NULL, + nullptr, }, { &sbn_vecs, "sbn", "NaviGPS GT-31/BGT-31 SiRF binary logfile (.sbn)", "sbn", - NULL, + nullptr, }, { &mmo_vecs, "mmo", "Memory-Map Navigator overlay files (.mmo)", "mmo", - NULL, + nullptr, }, { &bushnell_vecs, "bushnell", "Bushnell GPS Waypoint file", "wpt", - NULL, + nullptr, }, { &bushnell_trl_vecs, "bushnell_trl", "Bushnell GPS Trail file", "trl", - NULL, + nullptr, }, { &skyforce_vecs, "skyforce", "Skymap / KMD150 ascii files", - NULL, - NULL, + nullptr, + nullptr, }, { &pocketfms_bc_vecs, "pocketfms_bc", "PocketFMS breadcrumbs", - NULL, - NULL, + nullptr, + nullptr, }, { &pocketfms_fp_vecs, "pocketfms_fp", "PocketFMS flightplan (.xml)", "xml", - NULL, + nullptr, }, { &pocketfms_wp_vecs, "pocketfms_wp", "PocketFMS waypoints (.txt)", "txt", - NULL, + nullptr, }, { &v900_vecs, "v900", "Columbus/Visiontac V900 files (.csv)", - NULL, - NULL, + nullptr, + nullptr, }, { &ng_vecs, "naviguide", "Naviguide binary route file (.twl)", "twl", - NULL, + nullptr, }, { &enigma_vecs, "enigma", "Enigma binary waypoint file (.ert)", "ert", - NULL, + nullptr, }, { &skytraq_vecs, "skytraq", "SkyTraq Venus based loggers (download)", - NULL, - NULL, + nullptr, + nullptr, }, { &teletype_vecs, "teletype", "Teletype [ Get Jonathon Johnson to describe", - NULL, - NULL, + nullptr, + nullptr, }, { &skytraq_fvecs, "skytraq-bin", "SkyTraq Venus based loggers Binary File Format", "bin", - NULL, + nullptr, }, { &miniHomer_vecs, "miniHomer", "MiniHomer, a skyTraq Venus 6 based logger (download tracks, waypoints and get/set POI)", - NULL, - NULL, + nullptr, + nullptr, }, { &jogmap_vecs, "jogmap", "Jogmap.de XML format", "xml", - NULL, + nullptr, }, { &wintec_tes_vecs, "wintec_tes", "Wintec TES file", "tes", - NULL, + nullptr, }, { &subrip_vecs, "subrip", "SubRip subtitles for video mapping (.srt)", "srt", - NULL, + nullptr, }, { &format_garmin_xt_vecs, "garmin_xt", "Mobile Garmin XT Track files", - NULL, - NULL, + nullptr, + nullptr, }, { &format_fit_vecs, "garmin_fit", "Flexible and Interoperable Data Transfer (FIT) Activity file", "fit", - NULL, + nullptr, }, { &mapbar_track_vecs, "mapbar", "Mapbar (China) navigation track for Sonim Xp3300", "trk", - NULL, + nullptr, }, { &f90g_track_vecs, "f90g", "F90G Automobile DVR GPS log file", "map", - NULL, + nullptr, }, { &mapfactor_vecs, "mapfactor", "Mapfactor Navigator", "xml", - NULL, + nullptr, }, { &energympro_vecs, "energympro", "Energympro GPS training watch", "cpo", - NULL, + nullptr, }, { &mynav_vecs, "mynav", "MyNav TRC format", "trc", - NULL, + nullptr, }, { &geojson_vecs, "geojson", "GeoJson", "json", - NULL, + nullptr, }, { &ggv_bin_vecs, "ggv_bin", "Geogrid-Viewer binary overlay file (.ovl)", "ovl", - NULL, + nullptr, }, { &globalsat_sport_vecs, "globalsat", "GlobalSat GH625XT GPS training watch", - NULL, - NULL, + nullptr, + nullptr, }, #endif // MAXIMAL_ENABLED { - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, } }; @@ -1110,9 +1110,9 @@ init_vecs() arglist_t* ap; if (vec->vec->args) { for (ap = vec->vec->args; ap->argstring; ap++) { - ap->argvalptr = NULL; + ap->argvalptr = nullptr; if (ap->argval) { - *ap->argval = NULL; + *ap->argval = nullptr; } } } @@ -1144,7 +1144,7 @@ exit_vecs() } if (ap->argvalptr) { xfree(ap->argvalptr); - *ap->argval = ap->argvalptr = NULL; + *ap->argval = ap->argvalptr = nullptr; } } } @@ -1157,19 +1157,19 @@ assign_option(const char* module, arglist_t* ap, const char* val) { const char* c; - if (ap->argval == NULL) { + if (ap->argval == nullptr) { fatal("%s: No local variable defined for option \"%s\"!", module, ap->argstring); } - if (ap->argvalptr != NULL) { + if (ap->argvalptr != nullptr) { xfree(ap->argvalptr); - ap->argvalptr = NULL; + ap->argvalptr = nullptr; } if (ap->argval) { - *ap->argval = NULL; + *ap->argval = nullptr; } - if (val == NULL) { + if (val == nullptr) { return; } @@ -1234,7 +1234,7 @@ assign_option(const char* module, arglist_t* ap, const char* val) /* for bool options without default: don't set argval if "FALSE" */ if (((ap->argtype & ARGTYPE_TYPEMASK) == ARGTYPE_BOOL) && - (*c == '0') && (ap->defaultvalue == NULL)) { + (*c == '0') && (ap->defaultvalue == nullptr)) { return; } *ap->argval = ap->argvalptr = xstrdup(c); @@ -1264,7 +1264,7 @@ find_vec(const char* vecname, const char** opts) char* svecname = strtok(v, ","); int found = 0; - if (vecname == NULL) { + if (vecname == nullptr) { fatal("A format name is required.\n"); } @@ -1278,7 +1278,7 @@ find_vec(const char* vecname, const char** opts) if (res) { *opts = strchr(vecname, ',')+1; } else { - *opts = NULL; + *opts = nullptr; } if (vec->vec->args) { @@ -1295,10 +1295,10 @@ find_vec(const char* vecname, const char** opts) } } opt = inifile_readstr(global_opts.inifile, vec->name, ap->argstring); - if (opt == NULL) { + if (opt == nullptr) { opt = inifile_readstr(global_opts.inifile, "Common format settings", ap->argstring); } - if (opt == NULL) { + if (opt == nullptr) { opt = ap->defaultvalue; } assign_option(vec->name, ap, opt); @@ -1335,7 +1335,7 @@ find_vec(const char* vecname, const char** opts) if (res) { *opts = strchr(vecname, ',') + 1; } else { - *opts = NULL; + *opts = nullptr; } if (vec_list[0].vec->args) { @@ -1352,10 +1352,10 @@ find_vec(const char* vecname, const char** opts) } } opt = inifile_readstr(global_opts.inifile, svec->name, ap->argstring); - if (opt == NULL) { + if (opt == nullptr) { opt = inifile_readstr(global_opts.inifile, "Common format settings", ap->argstring); } - if (opt == NULL) { + if (opt == nullptr) { opt = ap->defaultvalue; } assign_option(svec->name, ap, opt); @@ -1382,7 +1382,7 @@ find_vec(const char* vecname, const char** opts) * Not found. */ xfree(v); - return NULL; + return nullptr; } /* @@ -1398,17 +1398,17 @@ get_option(const char* iarglist, const char* argname) { const size_t arglen = strlen(argname); char* arglist; - char* rval = NULL; + char* rval = nullptr; char* arg; char* argp; if (!iarglist) { - return NULL; + return nullptr; } arglist = xstrdup(iarglist); - for (arg = arglist; argp = strtok(arg, ","), NULL != argp; arg = NULL) { + for (arg = arglist; argp = strtok(arg, ","), nullptr != argp; arg = nullptr) { if (0 == case_ignore_strncmp(argp, argname, arglen)) { /* * If we have something of the form "foo=bar" @@ -1480,7 +1480,7 @@ sort_and_unify_vecs(int* ctp) /* Normal vecs are easy; populate the first part of the array. */ for (vec = vec_list; vec->vec; vec++, i++) { svp[i] = vec; - if (svp[i]->parent == NULL) { + if (svp[i]->parent == nullptr) { svp[i]->parent = svp[i]->name; } } @@ -1663,7 +1663,7 @@ disp_v3(const vecs_t* vec) { arglist_t* ap; - disp_help_url(vec, NULL); + disp_help_url(vec, nullptr); for (ap = vec->vec->args; ap && ap->argstring; ap++) { if (!(ap->argtype & ARGTYPE_HIDDEN)) { printf("option\t%s\t%s\t%s\t%s\t%s\t%s\t%s", diff --git a/vidaone.cc b/vidaone.cc index c70fe0935..a3c0fecd6 100644 --- a/vidaone.cc +++ b/vidaone.cc @@ -74,7 +74,7 @@ vidaone_rd_deinit() static void vidaone_read() { - route_head* trk = NULL; + route_head* trk = nullptr; while (! gbfeof(fin)) { Waypoint* wpt = new Waypoint; @@ -127,7 +127,7 @@ vidaone_trkpt(const Waypoint* wpt) static void vidaone_write() { - track_disp_all(NULL, NULL, vidaone_trkpt); + track_disp_all(nullptr, nullptr, vidaone_trkpt); } /**************************************************************************/ @@ -145,7 +145,7 @@ ff_vecs_t vidaone_vecs = { vidaone_wr_deinit, vidaone_read, vidaone_write, - NULL, + nullptr, vidaone_args, CET_CHARSET_UTF8, 1 , NULL_POS_OPS, diff --git a/vitosmt.cc b/vitosmt.cc index dd0e041f1..25ab34294 100644 --- a/vitosmt.cc +++ b/vitosmt.cc @@ -26,8 +26,8 @@ #define MYNAME "vitosmt" -static gbfile* infile =NULL; -static gbfile* ofs =NULL; +static gbfile* infile =nullptr; +static gbfile* ofs =nullptr; static long count =0; const long vitosmt_version =2; @@ -73,12 +73,12 @@ vitosmt_read() long check1 =-1; long check2 =-2; long check3 =-3; - route_head* route_head =0; - Waypoint* wpt_tmp =0; + route_head* route_head =nullptr; + Waypoint* wpt_tmp =nullptr; double latrad =0; double lonrad =0; double elev =0; - unsigned char* timestamp =0; + unsigned char* timestamp =nullptr; struct tm tmStruct; double seconds =0.0; double speed =0.0; @@ -200,13 +200,13 @@ vitosmt_read() if (doing_wpts) { /* process as waypoints */ waypt_add(wpt_tmp); } else if (doing_rtes) { /* process as route */ - if (route_head == NULL) { + if (route_head == nullptr) { route_head = route_head_alloc(); route_add_head(route_head); } route_add_wpt(route_head, wpt_tmp); } else { /* default track mode */ - if (route_head == NULL) { + if (route_head == nullptr) { route_head = route_head_alloc(); track_add_head(route_head); } @@ -236,7 +236,7 @@ wr_deinit() static void vitosmt_waypt_pr(const Waypoint* waypointp) { - unsigned char* workbuffer =0; + unsigned char* workbuffer =nullptr; size_t position =0; double seconds =0; @@ -315,7 +315,7 @@ vitosmt_waypt_pr(const Waypoint* waypointp) static void vitosmt_write() { - unsigned char* workbuffer =0; + unsigned char* workbuffer =nullptr; size_t position =0; workbuffer = (unsigned char*) xcalloc(vitosmt_headersize,1); @@ -330,9 +330,9 @@ vitosmt_write() if (doing_wpts) { /* process as waypoints */ waypt_disp_all(vitosmt_waypt_pr); } else if (doing_rtes) { /* process as route */ - route_disp_all(NULL, NULL, vitosmt_waypt_pr); + route_disp_all(nullptr, nullptr, vitosmt_waypt_pr); } else { /* default track mode */ - track_disp_all(NULL, NULL, vitosmt_waypt_pr); + track_disp_all(nullptr, nullptr, vitosmt_waypt_pr); } @@ -365,8 +365,8 @@ ff_vecs_t vitosmt_vecs = { wr_deinit, vitosmt_read, vitosmt_write, - NULL, - NULL, + nullptr, + nullptr, CET_CHARSET_UTF8, 1 /* do nothing | CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/vitovtt.cc b/vitovtt.cc index c989cd72a..46eb5ced3 100644 --- a/vitovtt.cc +++ b/vitovtt.cc @@ -30,7 +30,7 @@ #define TM_YEAR_ZERO 1900 #define TM_MONTH_ZERO 1 -static gbfile* infile = 0; +static gbfile* infile = nullptr; static int count = 0; static const int vitovtt_version = 3; @@ -58,8 +58,8 @@ static void vitovtt_read() { int version = 0; - route_head* route_head = 0; - Waypoint* wpt_tmp = 0; + route_head* route_head = nullptr; + Waypoint* wpt_tmp = nullptr; int scaled_lat = 0; int scaled_lon = 0; double altitude = 0; @@ -125,13 +125,13 @@ ff_vecs_t vitovtt_vecs = { ff_type_file, { ff_cap_none, ff_cap_read, ff_cap_none }, rd_init, - NULL, + nullptr, rd_deinit, - NULL, + nullptr, vitovtt_read, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, CET_CHARSET_UTF8, 1 /* do nothing | CET-REVIEW */ , NULL_POS_OPS, nullptr diff --git a/vpl.cc b/vpl.cc index 6d80ef0d6..426509f69 100644 --- a/vpl.cc +++ b/vpl.cc @@ -143,7 +143,7 @@ vpl_read() char* ibuf; // Set up a track - if (track_head == NULL) { + if (track_head == nullptr) { track_head = route_head_alloc(); track_add_head(track_head); } @@ -225,10 +225,10 @@ ff_vecs_t vpl_vecs = { vpl_rd_init, vpl_wr_init, vpl_rd_deinit, - NULL, + nullptr, vpl_read, - NULL, - NULL, + nullptr, + nullptr, vpl_args, CET_CHARSET_ASCII, /* ascii is the expected character set */ 1 /* fixed, can't be changed through command line parameter */ diff --git a/waypt.cc b/waypt.cc index e5ae6eae2..69665298a 100644 --- a/waypt.cc +++ b/waypt.cc @@ -201,7 +201,7 @@ waypt_status_disp(int total_ct, int myct) void waypt_disp_all(waypt_cb cb) { - waypt_disp_session(NULL, cb); + waypt_disp_session(nullptr, cb); } void @@ -216,7 +216,7 @@ waypt_disp_session(const session_t* se, waypt_cb cb) QUEUE_FOR_EACH(&waypt_head, elem, tmp) { waypointp = (Waypoint*) elem; #endif - if ((se == NULL) || (waypointp->session == se)) { + if ((se == nullptr) || (waypointp->session == se)) { if (global_opts.verbose_status) { i++; waypt_status_disp(waypt_count(), i); @@ -315,7 +315,7 @@ find_waypt_by_name(const QString& name) } } - return NULL; + return nullptr; } #if NEWQ @@ -396,7 +396,7 @@ waypt_backup(signed int* count, queue** head_bak) void waypt_restore(signed int count, queue* head_bak) { - if (head_bak == NULL) { + if (head_bak == nullptr) { return; } @@ -463,15 +463,15 @@ waypt_distance_ex(const Waypoint* A, const Waypoint* B) double res = 0; garmin_fs_p gmsd; - if ((A == NULL) || (B == NULL)) { + if ((A == nullptr) || (B == nullptr)) { return 0; } - if ((gmsd = GMSD_FIND(A)) && (gmsd->ilinks != NULL)) { + if ((gmsd = GMSD_FIND(A)) && (gmsd->ilinks != nullptr)) { garmin_ilink_t* link = gmsd->ilinks; res = gcgeodist(A->latitude, A->longitude, link->lat, link->lon); - while (link->next != NULL) { + while (link->next != nullptr) { garmin_ilink_t* prev = link; link = link->next; res += gcgeodist(prev->lat, prev->lon, link->lat, link->lon); @@ -487,7 +487,7 @@ waypt_distance_ex(const Waypoint* A, const Waypoint* B) double waypt_distance(const Waypoint* A, const Waypoint* B) { - if ((A == NULL) || (B == NULL)) { + if ((A == nullptr) || (B == nullptr)) { return 0; } else { return gcgeodist(A->latitude, A->longitude, B->latitude, B->longitude); @@ -622,9 +622,9 @@ Waypoint::Waypoint() : temperature(0), odometer_distance(0), gc_data(&Waypoint::empty_gc_data), - fs(NULL), + fs(nullptr), session(curr_session()), - extra_data(NULL) + extra_data(nullptr) { QUEUE_INIT(&Q); } @@ -724,7 +724,7 @@ QString Waypoint::CreationTimeXML() const { if (!creation_time.isValid()) { - return NULL; + return nullptr; } QDateTime dt = GetCreationTime().toUTC(); diff --git a/wbt-200.cc b/wbt-200.cc index 42a8a47fe..002ac9e44 100644 --- a/wbt-200.cc +++ b/wbt-200.cc @@ -147,8 +147,8 @@ static void db(int l, const char* msg, ...) static void buf_init(struct buf_head* h, size_t alloc) { - h->head = NULL; - h->tail = NULL; + h->head = nullptr; + h->tail = nullptr; h->alloc = alloc; h->used = 0; h->checksum = 0; @@ -162,8 +162,8 @@ static void buf_empty(struct buf_head* h) next = chunk->next; xfree(chunk); } - h->head = NULL; - h->tail = NULL; + h->head = nullptr; + h->tail = nullptr; h->used = 0; h->checksum = 0; } @@ -179,14 +179,14 @@ static size_t buf_read(struct buf_head* h, void* data, size_t len) char* bp = (char*) data; size_t got = 0; - while (len != 0 && h->current != NULL) { + while (len != 0 && h->current != nullptr) { size_t avail = h->current->used - h->offset; if (avail > len) { avail = len; } /* Allow NULL buffer pointer to skip bytes */ - if (NULL != bp) { + if (nullptr != bp) { memcpy(bp, buf_CHUNK_PTR(h->current, h->offset), avail); bp += avail; } @@ -210,11 +210,11 @@ static void buf_extend(struct buf_head* h, size_t amt) size_t sz = amt + sizeof(struct buf_chunk); c = (struct buf_chunk*) xmalloc(sz); - c->next = NULL; + c->next = nullptr; c->size = amt; c->used = 0; - if (NULL == h->head) { + if (nullptr == h->head) { h->head = c; } else { h->tail->next = c; @@ -245,7 +245,7 @@ static void buf_write(struct buf_head* h, const void* data, size_t len) h->used += len; - if (NULL == h->tail) { + if (nullptr == h->tail) { buf_extend(h, h->alloc); } @@ -397,7 +397,7 @@ static void rd_init(const QString& fname) port = xstrdup(qPrintable(fname)); db(1, "Opening port...\n"); - if ((fd = gbser_init(port)) == NULL) { + if ((fd = gbser_init(port)) == nullptr) { fatal(MYNAME ": Can't initialise port \"%s\"\n", port); } @@ -411,7 +411,7 @@ static void rd_deinit() { db(1, "Closing port...\n"); gbser_deinit(fd); - fd = NULL; + fd = nullptr; xfree(port); } @@ -430,7 +430,7 @@ static int rd_buf(void* buf, int len) static void file_init(const QString& fname) { db(1, "Opening file...\n"); - if ((fl = ufopen(fname, "rb")) == NULL) { + if ((fl = ufopen(fname, "rb")) == nullptr) { fatal(MYNAME ": Can't open file '%s'\n", qPrintable(fname)); } } @@ -572,7 +572,7 @@ static int wbt200_data_chunk(struct read_state* st, const void* buf, int fmt) uint32_t tim; double lat, lon, alt; time_t rtim; - Waypoint* tpt = NULL; + Waypoint* tpt = nullptr; const char* bp = (const char*) buf; size_t buf_used = fmt_version[fmt].reclen; @@ -593,17 +593,17 @@ static int wbt200_data_chunk(struct read_state* st, const void* buf, int fmt) if (lat >= 100) { /* Start new track in the northern hemisphere */ lat -= 100; - st->route_head_ = NULL; + st->route_head_ = nullptr; } else if (lat <= -100) { /* Start new track in the southern hemisphere */ /* This fix courtesy of Anton Frolich */ lat += 100; - st->route_head_ = NULL; + st->route_head_ = nullptr; } tpt = make_trackpoint(st, lat, lon, alt, rtim); - if (NULL == st->route_head_) { + if (nullptr == st->route_head_) { db(1, "New Track\n"); st->route_head_ = route_head_alloc(); track_add_head(st->route_head_); @@ -672,7 +672,7 @@ static void wbt200_process_data(struct read_state* pst, int fmt) static void state_init(struct read_state* pst) { - pst->route_head_ = NULL; + pst->route_head_ = nullptr; pst->wpn = 0; pst->tpn = 0; @@ -809,7 +809,7 @@ static int wbt201_data_chunk(struct read_state* st, const void* buf) uint16_t flags; double lat, lon, alt; time_t rtim; - Waypoint* tpt = NULL; + Waypoint* tpt = nullptr; const char* bp = (const char*) buf; /* Zero records are skipped */ @@ -838,12 +838,12 @@ static int wbt201_data_chunk(struct read_state* st, const void* buf) if (global_opts.masked_objective & TRKDATAMASK) { if (flags & WBT201_TRACK_START) { - st->route_head_ = NULL; + st->route_head_ = nullptr; } tpt = make_trackpoint(st, lat, lon, alt, rtim); - if (NULL == st->route_head_) { + if (nullptr == st->route_head_) { db(1, "New Track\n"); st->route_head_ = route_head_alloc(); track_add_head(st->route_head_); @@ -1046,7 +1046,7 @@ static void file_read() db(1, "Got TK1 file\n"); buf_rewind(&st.data); /* Seek */ - buf_read(&st.data, NULL, TK1_DATA_OFFSET); + buf_read(&st.data, nullptr, TK1_DATA_OFFSET); wbt201_process_chunk(&st); } else { db(1, "Got bin file\n"); @@ -1102,12 +1102,12 @@ ff_vecs_t wbt_svecs = { ff_type_serial, { ff_cap_read, ff_cap_read, ff_cap_none }, rd_init, - NULL, + nullptr, rd_deinit, - NULL, + nullptr, data_read, - NULL, - NULL, + nullptr, + nullptr, wbt_sargs, CET_CHARSET_UTF8, 1 /* master process: don't convert anything | CET-REVIEW */ , NULL_POS_OPS, @@ -1124,12 +1124,12 @@ ff_vecs_t wbt_fvecs = { ff_type_file, { ff_cap_none, ff_cap_read, ff_cap_none }, file_init, - NULL, + nullptr, file_deinit, - NULL, + nullptr, file_read, - NULL, - NULL, + nullptr, + nullptr, wbt_fargs, CET_CHARSET_UTF8, 1 /* master process: don't convert anything | CET-REVIEW */ , NULL_POS_OPS, diff --git a/wfff_xml.cc b/wfff_xml.cc index d910895fa..19a2c7fbc 100644 --- a/wfff_xml.cc +++ b/wfff_xml.cc @@ -23,31 +23,31 @@ #include /* argument storage */ -static char* aicicon =0; -static char* aioicon =0; -static char* ahcicon =0; -static char* ahoicon =0; -static char* snmac =0; +static char* aicicon =nullptr; +static char* aioicon =nullptr; +static char* ahcicon =nullptr; +static char* ahoicon =nullptr; +static char* snmac =nullptr; static arglist_t wfff_xml_args[] = { { "aicicon", &aicicon, "Infrastructure closed icon name", - "Red Square", ARGTYPE_STRING, ARG_NOMINMAX, NULL + "Red Square", ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "aioicon", &aioicon, "Infrastructure open icon name", - "Green Square", ARGTYPE_STRING, ARG_NOMINMAX, NULL + "Green Square", ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "ahcicon", &ahcicon, "Ad-hoc closed icon name", - "Red Diamond", ARGTYPE_STRING, ARG_NOMINMAX, NULL + "Red Diamond", ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "ahoicon", &ahoicon, "Ad-hoc open icon name", - "Green Diamond", ARGTYPE_STRING, ARG_NOMINMAX, NULL + "Green Diamond", ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, - {"snmac", &snmac, "Shortname is MAC address", NULL, ARGTYPE_BOOL, ARG_NOMINMAX, NULL }, + {"snmac", &snmac, "Shortname is MAC address", nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, ARG_TERMINATOR }; @@ -78,7 +78,7 @@ xg_tag_mapping loc_map[] = { { wfff_hdop, cb_cdata, "/DocumentElement/AP/HDOP" }, { wfff_lat, cb_cdata, "/DocumentElement/AP/Lat" }, { wfff_lon, cb_cdata, "/DocumentElement/AP/Lon" }, - { 0,(xg_cb_type)0,0 } + { nullptr,(xg_cb_type)0,nullptr } }; /* work variables for wfff_xxx */ @@ -150,7 +150,7 @@ static long tosscount=0; void wfff_e(xg_string, const QXmlStreamAttributes*) { - Waypoint* wpt_tmp =0; + Waypoint* wpt_tmp =nullptr; char desc[255] ="\0"; if ((ap_hdop>=1)&&(ap_hdop<50)) { // Discard invalid GPS fix @@ -204,7 +204,7 @@ wfff_xml_rd_init(const QString& fname) { tosscount = 0; - xml_init(fname, loc_map, NULL); + xml_init(fname, loc_map, nullptr); } void @@ -229,12 +229,12 @@ ff_vecs_t wfff_xml_vecs = { ff_type_file, {ff_cap_read, ff_cap_none, ff_cap_none}, wfff_xml_rd_init, - 0, + nullptr, wfff_xml_rd_deinit, - 0, + nullptr, wfff_xml_read, - 0, - 0, + nullptr, + nullptr, wfff_xml_args, CET_CHARSET_UTF8, 0, NULL_POS_OPS, diff --git a/wintec_tes.cc b/wintec_tes.cc index baae71814..bd7b368d6 100644 --- a/wintec_tes.cc +++ b/wintec_tes.cc @@ -106,12 +106,12 @@ ff_vecs_t wintec_tes_vecs = { ff_cap_none /* routes */ }, wintec_tes_rd_init, - NULL, + nullptr, wintec_tes_rd_deinit, - NULL, + nullptr, wintec_tes_read, - NULL, - NULL, + nullptr, + nullptr, wintec_tes_args, CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ /* not fixed, can be changed through command line parameter */ diff --git a/xcsv.cc b/xcsv.cc index 9a0242f9d..583f51d1c 100644 --- a/xcsv.cc +++ b/xcsv.cc @@ -38,47 +38,47 @@ #define MYNAME "XCSV" #define ISSTOKEN(a,b) (strncmp(a,b, strlen(b)) == 0) -static char* styleopt = NULL; -static char* snlenopt = NULL; -static char* snwhiteopt = NULL; -static char* snupperopt = NULL; -static char* snuniqueopt = NULL; -char* prefer_shortnames = NULL; -char* xcsv_urlbase = NULL; +static char* styleopt = nullptr; +static char* snlenopt = nullptr; +static char* snwhiteopt = nullptr; +static char* snupperopt = nullptr; +static char* snuniqueopt = nullptr; +char* prefer_shortnames = nullptr; +char* xcsv_urlbase = nullptr; static char* opt_datum; -static const char* intstylebuf = NULL; +static const char* intstylebuf = nullptr; static arglist_t xcsv_args[] = { { - "style", &styleopt, "Full path to XCSV style file", NULL, + "style", &styleopt, "Full path to XCSV style file", nullptr, ARGTYPE_FILE | ARGTYPE_REQUIRED, ARG_NOMINMAX, nullptr }, { - "snlen", &snlenopt, "Max synthesized shortname length", NULL, - ARGTYPE_INT, "1", NULL, nullptr + "snlen", &snlenopt, "Max synthesized shortname length", nullptr, + ARGTYPE_INT, "1", nullptr, nullptr }, { "snwhite", &snwhiteopt, "Allow whitespace synth. shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "snupper", &snupperopt, "UPPERCASE synth. shortnames", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "snunique", &snuniqueopt, "Make synth. shortnames unique", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "urlbase", &xcsv_urlbase, "Basename prepended to URL on output", - NULL, ARGTYPE_STRING, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_STRING, ARG_NOMINMAX, nullptr }, { "prefer_shortnames", &prefer_shortnames, "Use shortname instead of description", - NULL, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr + nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr }, { "datum", &opt_datum, "GPS datum (def. WGS 84)", @@ -104,7 +104,7 @@ char_map_t xcsv_char_table[] = { { "HASH", "#" }, { "WHITESPACE", "\\w" }, { "PIPE", "|" }, - { NULL, NULL } + { nullptr, nullptr } }; void @@ -216,7 +216,7 @@ xcsv_parse_style_line(char* sbuff) */ /* whack off any comments */ - if ((p = strchr(sbuff, '#')) != NULL) { + if ((p = strchr(sbuff, '#')) != nullptr) { if ((p > sbuff) && p[-1] == '\\') { memmove(p-1, p, strlen(p)); p[strlen(p)-1] = '\0'; @@ -369,7 +369,7 @@ xcsv_parse_style_line(char* sbuff) } else if (ISSTOKEN(sbuff, "IFIELD")) { - key = val = pfc = NULL; + key = val = pfc = nullptr; s = csv_lineparse(&sbuff[6], ",", "", linecount); @@ -393,7 +393,7 @@ xcsv_parse_style_line(char* sbuff) } i++; - s = csv_lineparse(NULL, ",", "", linecount); + s = csv_lineparse(nullptr, ",", "", linecount); } xcsv_ifield_add(key, val, pfc); @@ -407,7 +407,7 @@ xcsv_parse_style_line(char* sbuff) */ if (ISSTOKEN(sbuff, "OFIELD")) { int options = 0; - key = val = pfc = NULL; + key = val = pfc = nullptr; s = csv_lineparse(&sbuff[6], ",", "", linecount); @@ -441,7 +441,7 @@ xcsv_parse_style_line(char* sbuff) break; } i++; - s = csv_lineparse(NULL, ",", "", linecount); + s = csv_lineparse(nullptr, ",", "", linecount); } xcsv_ofield_add(key, val, pfc, options); @@ -580,10 +580,10 @@ xcsv_rd_deinit(void) { xcsv_file.file->close(); delete xcsv_file.file; - xcsv_file.file = NULL; + xcsv_file.file = nullptr; delete xcsv_file.stream; - xcsv_file.stream = NULL; - xcsv_file.codec = NULL; + xcsv_file.stream = nullptr; + xcsv_file.codec = nullptr; xcsv_destroy_style(); } @@ -660,10 +660,10 @@ xcsv_wr_deinit(void) xcsv_file.stream->flush(); xcsv_file.file->close(); delete xcsv_file.file; - xcsv_file.file = NULL; + xcsv_file.file = nullptr; delete xcsv_file.stream; - xcsv_file.stream = NULL; - xcsv_file.codec = NULL; + xcsv_file.stream = nullptr; + xcsv_file.codec = nullptr; xcsv_destroy_style(); } @@ -703,10 +703,10 @@ ff_vecs_t xcsv_vecs = { xcsv_wr_deinit, xcsv_data_read, xcsv_data_write, - NULL, + nullptr, xcsv_args, CET_CHARSET_ASCII, 0, /* CET-REVIEW */ - { NULL, NULL, NULL, xcsv_wr_position_init, xcsv_wr_position, xcsv_wr_position_deinit }, + { nullptr, nullptr, nullptr, xcsv_wr_position_init, xcsv_wr_position, xcsv_wr_position_deinit }, nullptr }; diff --git a/xmlgeneric.cc b/xmlgeneric.cc index 76e6937d6..aee85d1d2 100644 --- a/xmlgeneric.cc +++ b/xmlgeneric.cc @@ -61,12 +61,12 @@ xg_callback* xml_tbl_lookup(const QString& tag, xg_cb_type cb_type) { xg_tag_mapping* tm; - for (tm = xg_tag_tbl; tm->tag_cb != NULL; tm++) { + for (tm = xg_tag_tbl; tm->tag_cb != nullptr; tm++) { if (str_match(CSTR(tag), tm->tag_name) && (cb_type == tm->cb_type)) { return tm->tag_cb; } } - return NULL; + return nullptr; } void @@ -88,8 +88,8 @@ xml_deinit() { reader_data.clear(); rd_fname.clear(); - xg_tag_tbl = NULL; - xg_encoding = NULL; + xg_tag_tbl = nullptr; + xg_encoding = nullptr; codec = utf8_codec; } @@ -110,7 +110,7 @@ xml_run_parser(QXmlStreamReader& reader, QString& current_tag) if (!reader.documentEncoding().isEmpty()) { codec = QTextCodec::codecForName(CSTR(reader.documentEncoding().toString())); } - if (codec == NULL) { + if (codec == nullptr) { // According to http://www.opentag.com/xfaq_enc.htm#enc_default , we // should assume UTF-8 in absense of other informations. Users can // EASILY override this with xml_init(). @@ -129,7 +129,7 @@ xml_run_parser(QXmlStreamReader& reader, QString& current_tag) cb = xml_tbl_lookup(current_tag, cb_start); if (cb) { const QXmlStreamAttributes attrs = reader.attributes(); - cb(NULL, &attrs); + cb(nullptr, &attrs); } cb = xml_tbl_lookup(current_tag, cb_cdata); @@ -139,7 +139,7 @@ xml_run_parser(QXmlStreamReader& reader, QString& current_tag) // thus we will not process the EndElement case as we will issue a readNext first. // does a caller ever expect to be able to use both a cb_cdata and a // cb_end callback? - cb(c, NULL); + cb(c, nullptr); current_tag.chop(reader.qualifiedName().length() + 1); } break; @@ -151,7 +151,7 @@ xml_run_parser(QXmlStreamReader& reader, QString& current_tag) cb = xml_tbl_lookup(current_tag, cb_end); if (cb) { - cb(reader.name().toString(), NULL); + cb(reader.name().toString(), nullptr); } current_tag.chop(reader.qualifiedName().length() + 1); break; diff --git a/xmltag.cc b/xmltag.cc index bd2d5f179..021da7cd7 100644 --- a/xmltag.cc +++ b/xmltag.cc @@ -29,7 +29,7 @@ static void free_xml_tag(xml_tag* tag) { - xml_tag* next = NULL; + xml_tag* next = nullptr; char** ap; while (tag) { @@ -56,13 +56,13 @@ free_xml_tag(xml_tag* tag) static void copy_xml_tag(xml_tag** copy, xml_tag* src, xml_tag* parent) { - xml_tag* res = NULL; - char** ap = NULL; - char** ap2 = NULL; + xml_tag* res = nullptr; + char** ap = nullptr; + char** ap2 = nullptr; int count = 0; if (!src) { - *copy = NULL; + *copy = nullptr; return; } @@ -96,9 +96,9 @@ copy_xml_tag(xml_tag** copy, xml_tag* src, xml_tag* parent) static void convert_xml_tag(xml_tag* tag) { - char** ap = NULL; + char** ap = nullptr; - if (tag == NULL) { + if (tag == nullptr) { return; } @@ -133,12 +133,12 @@ fs_xml_copy(void** copy, void* source) { fs_xml* src = (fs_xml*)source; if (!source) { - *copy = NULL; + *copy = nullptr; return; } *copy = (void*)fs_xml_alloc(src->fs.type); memcpy(*copy, source, sizeof(fs_xml)); - copy_xml_tag(&(((fs_xml*)(*copy))->tag), src->tag, NULL); + copy_xml_tag(&(((fs_xml*)(*copy))->tag), src->tag, nullptr); } static void @@ -152,7 +152,7 @@ fs_xml_convert(void* fs) fs_xml* fs_xml_alloc(long type) { - fs_xml* result = NULL; + fs_xml* result = nullptr; result = (fs_xml*)xcalloc(1, sizeof(fs_xml)); result->fs.type = type; diff --git a/xol.cc b/xol.cc index 5ae3e2381..90706b0a1 100644 --- a/xol.cc +++ b/xol.cc @@ -52,7 +52,7 @@ static xg_tag_mapping xol_map[] = { { xol_shape, cb_start, XOL "/shapes/*shape" }, { xol_shape_end, cb_end, XOL "/shapes/*shape" }, { xol_waypt, cb_start, XOL "/shapes/shape/*points/point" }, - { NULL, (xg_cb_type)0, NULL} }; + { nullptr, (xg_cb_type)0, nullptr} }; static void xol_overlay(xg_string, const QXmlStreamAttributes* attrv) { if (attrv->hasAttribute("version")) { @@ -108,12 +108,12 @@ static void xol_shape_end(xg_string, const QXmlStreamAttributes*) { } else { waypt_add(wpt); } - wpt = NULL; + wpt = nullptr; } else if (trk) { if (trk->rte_waypt_ct == 0) { track_del_head(trk); } - trk = NULL; + trk = nullptr; } } @@ -132,10 +132,10 @@ static void xol_waypt(xg_string, const QXmlStreamAttributes* attrv) { } static void xol_rd_init(const QString& fname) { - trk = NULL; - wpt = NULL; + trk = nullptr; + wpt = nullptr; - xml_init(fname, xol_map, NULL); + xml_init(fname, xol_map, nullptr); } static void xol_read() { xml_read(); } @@ -147,7 +147,7 @@ static void xol_rd_deinit() { xml_deinit(); } static void xol_fatal_outside(const Waypoint* wpt) { fatal(MYNAME ": %s (%s) is outside of convertable area \"%s\"!\n", wpt->shortname.isEmpty() ? "Waypoint" : qPrintable(wpt->shortname), - pretty_deg_format(wpt->latitude, wpt->longitude, 'd', NULL, 0), + pretty_deg_format(wpt->latitude, wpt->longitude, 'd', nullptr, 0), gt_get_mps_grid_longname(grid_swiss, MYNAME)); } @@ -179,11 +179,11 @@ static void xol_wr_deinit() { mkshort_del_handle(&short_h); writer->writeEndDocument(); delete writer; - writer = NULL; + writer = nullptr; oqfile->close(); delete oqfile; - oqfile = NULL; + oqfile = nullptr; } static void xol_waypt_disp_cb(const Waypoint* wpt) { @@ -263,7 +263,7 @@ static void xol_write() { double x, y; waypt_disp_all(xol_waypt_bound_calc); - track_disp_all(NULL, NULL, xol_waypt_bound_calc); + track_disp_all(nullptr, nullptr, xol_waypt_bound_calc); if (!waypt_bounds_valid(&all_bounds)) { fatal(MYNAME ": No data available!\n"); @@ -305,7 +305,7 @@ ff_vecs_t xol_vecs = {ff_type_file, xol_wr_deinit, xol_read, xol_write, - NULL, + nullptr, xol_args, CET_CHARSET_UTF8, 0 , NULL_POS_OPS, diff --git a/yahoo.cc b/yahoo.cc index 30e447e66..78225772e 100644 --- a/yahoo.cc +++ b/yahoo.cc @@ -51,13 +51,13 @@ static xg_tag_mapping gl_map[] = { { wpt_addr, cb_cdata, "/ResultSet/Result/Zip" }, { wpt_addr, cb_cdata, "/ResultSet/Result/Country" }, { wpt_e, cb_end, "/ResultSet/Result" }, - { NULL, (xg_cb_type)0, NULL} + { nullptr, (xg_cb_type)0, nullptr} }; static void yahoo_rd_init(const QString& fname) { - xml_init(fname, gl_map, NULL); + xml_init(fname, gl_map, nullptr); } static void @@ -86,7 +86,7 @@ void wpt_s(xg_string, const QXmlStreamAttributes*) void wpt_e(xg_string, const QXmlStreamAttributes*) { waypt_add(wpt_tmp); - wpt_tmp = NULL; + wpt_tmp = nullptr; } void wpt_lat(xg_string args, const QXmlStreamAttributes*) @@ -113,10 +113,10 @@ ff_vecs_t yahoo_vecs = { yahoo_rd_init, yahoo_wr_init, yahoo_rd_deinit, - NULL, + nullptr, yahoo_read, - NULL, - NULL, + nullptr, + nullptr, yahoo_args, CET_CHARSET_ASCII, 0 /* CET-REVIEW */ , NULL_POS_OPS, -- 2.30.2